Categorygithub.com/golib2020/frame
module
0.0.0-20191129085907-f1b58f724f7f
Repository: https://github.com/golib2020/frame.git
Documentation: pkg.go.dev

# README

frame

Go Doc Build Status Go Report Code Coverage Internal ready License

基础开发框架

依赖

go get -u github.com/golib2020/frame

简单演示

package main

import (
    fmt

    github.com/golib2020/frame/f
)

func main() { 
    c := f.Config()
    fmt.Println(c.GetString("db.default.dsn"))
}

配置

配置环境变量 APP_ENV 配置文件为 config.<app_env>.json

默认 config.json

模版

{
  "db": {
    "default": {
      "driver": "<mysql | xorm所支持的数据库类型>", 
      "dsn": "<user>:<password>@(<host>:<port>)/<dbname>?charset=utf8mb4",
      "max": {
        "open": 10,
        "idle": 2,
        "life": "60s"
      }
    }
  },
  "redis": {
    "default": {
      "driver": "radix",
      "addr": "<host>:6379",
      "pass": "",
      "db": 0,
      "size": 10
    }
  },
  "storage": {
    "default": {
      "driver": "local",
      "root": "/storage/",
      "host": "/"
    },
    "aliyun": {
      "driver": "oss",
      "root": "< / | 根路径>",
      "host": "<访问域名的 如:https://domain/ >",
      "secret_id": "<secret_id>",
      "secret_key": "<secret_key>",
      "endpoint": "<endpoint>",
      "bucket_name": "<bucket_name>"
    },
    "tencent": {
      "driver": "cos",
      "root": "< / | 根路径>",
      "host": "<访问域名的>",
      "secret_id": "<secret_id>",
      "secret_key": "<secret_key>",
      "region": "<region>",
      "bucket_name": "<bucket_name>"
    }
  },
  "email": {
    "default": {
      "addr": "<host>:465",
      "user": "<user email>",
      "pass": "<password>",
      "name": "<发送人的名字>"
    }
  },
  "cache": {
    "default": {
      "driver": "redis",
      "prefix": "<prefix>"
    },
    "local": {
      "driver": "local",
      "prefix": "<prefix>",
      "root": "./"
    }
  }
}

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author