Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Captcha ¶
type Captcha struct {
KeyLong int `mapstructure:"key-long" json:"key-long" yaml:"key-long"` // 验证码长度
ImgWidth int `mapstructure:"img-width" json:"img-width" yaml:"img-width"` // 验证码宽度
ImgHeight int `mapstructure:"img-height" json:"img-height" yaml:"img-height"` // 验证码高度
IsOpen int `mapstructure:"is-open" json:"is-open" yaml:"is-open"` // 防爆破验证码开启此数,0代表每次登录都需要验证码,其他数字代表错误密码此数,如3代表错误三次后出现验证码
CaptchaTimeOut int `mapstructure:"captcha-timeout" json:"captcha-timeout" yaml:"captcha-timeout"` // 防爆破验证码超时时间,单位:s(秒)
}
type Config ¶
type Config struct {
Server Server `mapstructure:"server" json:"server" yaml:"server"`
Redis Redis `mapstructure:"redis" json:"redis" yaml:"redis"`
Mysql Mysql `mapstructure:"mysql" json:"mysql" yaml:"mysql"`
Zap Zap `mapstructure:"zap" json:"zap" yaml:"zap"`
Jwt Jwt `mapstructure:"jwt" json:"jwt" yaml:"jwt"`
Captcha Captcha `mapstructure:"captcha" json:"captcha" yaml:"captcha"`
Cors Cors `mapstructure:"cors" json:"cors" yaml:"cors"`
}
type Cors ¶
type Cors struct {
Mode string `mapstructure:"mode" json:"mode" yaml:"mode"`
Whitelist []CorsWhitelist `mapstructure:"whitelist" json:"whitelist" yaml:"whitelist"`
}
type CorsWhitelist ¶
type CorsWhitelist struct {
AllowOrigin string `mapstructure:"allow-origin" json:"allow-origin" yaml:"allow-origin"`
AllowMethods string `mapstructure:"allow-methods" json:"allow-methods" yaml:"allow-methods"`
AllowHeaders string `mapstructure:"allow-headers" json:"allow-headers" yaml:"allow-headers"`
ExposeHeaders string `mapstructure:"expose-headers" json:"expose-headers" yaml:"expose-headers"`
AllowCredentials bool `mapstructure:"allow-credentials" json:"allow-credentials" yaml:"allow-credentials"`
}
type Jwt ¶
type Jwt struct {
SigningKey string `mapstructure:"signing-key" json:"signing-key" yaml:"signing-key"` // jwt签名
ExpiresTime string `mapstructure:"expires-time" json:"expires-time" yaml:"expires-time"` // 过期时间
BufferTime string `mapstructure:"buffer-time" json:"buffer-time" yaml:"buffer-time"` // 缓冲时间
Issuer string `mapstructure:"issuer" json:"issuer" yaml:"issuer"` // 签发者
}
type Mysql ¶
type Mysql struct {
Dsn string `mapstructure:"dsn" json:"dsn" yaml:"dsn"`
Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"`
Singular bool `mapstructure:"singular" json:"singular" yaml:"singular"`
MaxIdleConns int `mapstructure:"max-idle-conns" json:"max-idle-conns" yaml:"max-idle-conns"`
MaxOpenConns int `mapstructure:"max-open-conns" json:"max-open-conns" yaml:"max-open-conns"`
LogLevel string `mapstructure:"log-level" json:"log-level" yaml:"log-level"`
}
type Server ¶
type Server struct {
Env string `mapstructure:"env" json:"env" yaml:"env"` // 环境值
Addr string `mapstructure:"addr" json:"addr" yaml:"addr"` // 端口值
LimitCountIp int `mapstructure:"ip-limit-count" json:"ip-limit-count" yaml:"ip-limit-count"`
LimitTimeIp int `mapstructure:"ip-limit-time" json:"ip-limit-time" yaml:"ip-limit-time"`
UseMultipoint bool `mapstructure:"use-multipoint" json:"use-multipoint" yaml:"use-multipoint"` // 多点登录拦截
UseRedis bool `mapstructure:"use-redis" json:"use-redis" yaml:"use-redis"` // 使用redis
RouterPrefix string `mapstructure:"router-prefix" json:"router-prefix" yaml:"router-prefix"`
}
type Zap ¶
type Zap struct {
Level string `mapstructure:"level" json:"level" yaml:"level"`
Format string `mapstructure:"format" json:"format" yaml:"format"`
Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"`
OutputDir string `mapstructure:"output-dir" json:"output-dir" yaml:"output-dir"`
LogFile string `mapstructure:"log-file" json:"log-file" yaml:"log-file"`
MaxSize int `mapstructure:"max-size" json:"max-size" yaml:"max-size"`
MaxAge int `mapstructure:"max-age" json:"max-age" yaml:"max-age"`
MaxBackup int `mapstructure:"max-backup" json:"max-backup" yaml:"max-backup"`
Compress bool `mapstructure:"compress" json:"compress" yaml:"compress"`
ShowLine bool `mapstructure:"show-line" json:"show-line" yaml:"show-line"`
StacktraceKey string `mapstructure:"stacktrace-key" json:"stacktrace-key" yaml:"stacktrace-key"`
LogInConsole bool `mapstructure:"log-in-console" json:"log-in-console" yaml:"log-in-console"`
WriteSync zapcore.WriteSyncer
}
func (*Zap) CustomTimeEncoder ¶
func (z *Zap) CustomTimeEncoder(t time.Time, encoder zapcore.PrimitiveArrayEncoder)
CustomTimeEncoder customize datetime output format
func (*Zap) GetEncoderConfig ¶
func (z *Zap) GetEncoderConfig() zapcore.EncoderConfig
GetEncoderConfig get zap encoder config
func (*Zap) GetLogLevel ¶
GetLogLevel get zapcore.Level via string
Click to show internal directories.
Click to hide internal directories.