f

package
v0.0.0-...-f1b58f7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2019 License: MIT Imports: 12 Imported by: 0

README

配置文件模版 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": "./"
    }
  }
}

Documentation

Index

Constants

View Source
const (
	XormInstancePrefix = `xorm`
	XormDefaultGroup   = `default`
)

Variables

This section is empty.

Functions

func Cache

func Cache(name ...string) cache.Cache

Cache 缓存

func Config

func Config() *viper.Viper

Config 配置

func Cron

func Cron() cron.Cron

Corn 定时任务

func DB

func DB(name ...string) *xorm.Engine

func Email

func Email(name ...string) email.Email

Email 邮件服务

func Mysql

func Mysql(name ...string) *sql.DB

Mysql mysql实例

func Queue

func Queue() interface{}

Queue 队列 | 腾讯云CMQ + 云函数

func Redis

func Redis(name ...string) redis.Redis

Redis redis实例

func Storage

func Storage(name ...string) storage.Storage

Storage 持久存储

func Xorm

func Xorm(name ...string) *xorm.Engine

Types

type Store

type Store interface {
	GetOrSet(key string, data interface{}) interface{}
	GetOrSetFunc(key string, data func() interface{}) interface{}
}

func Instance

func Instance() Store

func NewStore

func NewStore() Store

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL