Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AliyunOSS ¶
type AliyunOSS struct { Endpoint string `mapstructure:"endpoint" yaml:"endpoint"` AccessKeyId string `mapstructure:"access-key-id" yaml:"access-key-id"` AccessKeySecret string `mapstructure:"access-key-secret" yaml:"access-key-secret"` BucketName string `mapstructure:"bucket-name" yaml:"bucket-name"` BucketUrl string `mapstructure:"bucket-url" yaml:"bucket-url"` BasePath string `mapstructure:"base-path" yaml:"base-path"` }
type Config ¶
type Config struct { Server Server `mapstructure:"server" yaml:"server"` Mysql Mysql `mapstructure:"mysql" yaml:"mysql"` Redis Redis `mapstructure:"redis" yaml:"redis"` JWT JWT `mapstructure:"jwt" yaml:"jwt"` Zap Zap `mapstructure:"zap" yaml:"zap"` AliyunOSS AliyunOSS `mapstructure:"aliyun-oss" yaml:"aliyun-oss"` }
Config 读取配置
type JWT ¶
type JWT struct { SigningKey string `mapstructure:"signing-key" yaml:"signing-key"` // jwt签名 ExpiresTime string `mapstructure:"expires-time" yaml:"expires-time"` // 过期时间 BufferTime string `mapstructure:"buffer-time" yaml:"buffer-time"` // 缓冲时间 Issuer string `mapstructure:"issuer" yaml:"issuer"` // 发行者 }
JWT 配置
type Mysql ¶
type Mysql struct { Prefix string `mapstructure:"prefix" yaml:"prefix"` Port string `mapstructure:"port" yaml:"port"` Config string `mapstructure:"config" yaml:"config"` // 高级配置 DbName string `mapstructure:"db-name" yaml:"db-name"` // 数据库名 Username string `mapstructure:"username" yaml:"username"` // 数据库密码 Password string `mapstructure:"password" yaml:"password"` // 数据库密码 Path string `mapstructure:"path" yaml:"path"` Engine string `mapstructure:"engine" yaml:"engine" default:"InnoDB"` //数据库引擎,默认InnoDB LogMode string `mapstructure:"log-mode" yaml:"log-mode"` // 是否开启Gorm全局日志 MaxIdleConns int `mapstructure:"max-idle-conns" yaml:"max-idle-conns"` // 空闲中的最大连接数 MaxOpenConns int `mapstructure:"max-open-conns" yaml:"max-open-conns"` // 打开到数据库的最大连接数 Singular bool `mapstructure:"singular" yaml:"singular"` //是否开启全局禁用复数,true表示开启 LogZap bool `mapstructure:"log-zap" yaml:"log-zap"` }
Mysql 配置
func (*Mysql) Connection ¶
func (*Mysql) GetLogMode ¶
func (*Mysql) InitConfig ¶
type Redis ¶
type Redis struct { Addr string `mapstructure:"addr" yaml:"addr"` // 服务器地址:端口 Password string `mapstructure:"password" yaml:"password"` // 密码 DB int `mapstructure:"db" yaml:"db"` // redis的哪个数据库 }
Redis 配置
type Server ¶
type Server struct { Port int `mapstructure:"port" yaml:"port"` Mode string `mapstructure:"mode" yaml:"mode"` RouterPrefix string `mapstructure:"router-prefix" yaml:"router-prefix"` UseMultipoint bool `mapstructure:"use-multipoint" yaml:"use-multipoint"` // 多点登录拦截 UseOSS bool `mapstructure:"use-oss" yaml:"use-oss"` FilePath string `mapstructure:"file-path" yaml:"file-path"` }
Server 服务配置
type Zap ¶
type Zap struct { Level string `mapstructure:"level" yaml:"level"` // 级别 Prefix string `mapstructure:"prefix" yaml:"prefix"` // 日志前缀 Format string `mapstructure:"format" yaml:"format"` // 输出 Directory string `mapstructure:"directory" yaml:"directory"` // 日志文件夹 EncodeLevel string `mapstructure:"encode-level" yaml:"encode-level"` // 编码级 StacktraceKey string `mapstructure:"stacktrace-key" yaml:"stacktrace-key"` // 栈名 MaxAge int `mapstructure:"max-age" yaml:"max-age"` // 日志留存时间 ShowLine bool `mapstructure:"show-line" yaml:"show-line"` // 显示行 UserLoginConsole bool `mapstructure:"log-in-console" yaml:"log-in-console"` // 输出控制台 }
Zap 配置
func (*Zap) TransportLevel ¶
TransportLevel 根据字符串转化为 zapcore.Level
func (*Zap) ZapEncodeLevel ¶
func (z *Zap) ZapEncodeLevel() zapcore.LevelEncoder
ZapEncodeLevel 根据 EncodeLevel 返回 zapcore.LevelEncoder
Source Files ¶
Click to show internal directories.
Click to hide internal directories.