Documentation ¶
Index ¶
- Variables
- func InitValidateTrans(validate *validator.Validate) ut.Translator
- func RandCheckCode(n int) string
- func RandString(base string, n int) string
- func TransError(err error) string
- func UID() string
- type EmailCfgParam
- type HttpServerParam
- type JwtUserInfoClaims
- type MysqlCfgParam
- type RedisCfgParam
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Log *zap.SugaredLogger DBCfg MysqlCfgParam RedisCfg = &RedisCfgParam{} RedisClient *redis.Client ServerCfg HttpServerParam EmailCfg = &EmailCfgParam{} DB *sqlx.DB )
View Source
var ImageCompress imageCompress = (*imageCompressImpl)(nil)
View Source
var Jwt jwtInterface = (*jwtImpl)(nil)
Jwt操作
View Source
var MysqlUtil mysqlUtil = (*mysqlUtilImpl)(nil)
View Source
var (
Trans ut.Translator
)
Functions ¶
func InitValidateTrans ¶
func InitValidateTrans(validate *validator.Validate) ut.Translator
func RandString ¶
RandString randomly generate a specified length string based on the given string 依据给定字符串生成给定长度的随机字符串
func TransError ¶
Types ¶
type EmailCfgParam ¶
type EmailCfgParam struct { Name string `toml:"name" xml:"name" json:"name"` // 发送者名称 MailAddr string `toml:"mailAddr" xml:"mailAddr" json:"mailAddr"` // 发送者邮箱地址 youemail@email.com SmtpAddr string `toml:"smtpAddr" xml:"smtpAddr" json:"smtpAddr"` // 邮箱服务器地址(包含端口号)非SSL协议: 例如网易的 smtp.163.com:25 HostAddr string `toml:"hostAddr" xml:"hostAddr" json:"hostAddr"` // 登录授权时服务器地址,不包含端口号: 例如网易的 smtp.163.com Password string `toml:"password" xml:"password" json:"password"` // 发送者邮箱授权密钥 IsStatus bool // 是否启用 }
邮箱配置
type HttpServerParam ¶
type HttpServerParam struct { JwtKey string `json:"jwtKey" toml:"jwtKey" yaml:"jwtKey" xml:"jwtKey"` Port string `json:"port" toml:"port" yaml:"port" xml:"port"` UseHttps bool `json:"useHttps" toml:"useHttps" yaml:"useHttps" xml:"useHttps"` HttpsKey string `json:"httpsKey" toml:"httpsKey" yaml:"httpsKey" xml:"httpsKey"` HttpsPem string `json:"httpsPem" toml:"httpsPem" yaml:"httpsPem" xml:"httpsPem"` HttpsHost string `json:"httpsHost" toml:"httpsHost" yaml:"httpsHost" xml:"httpsHost"` }
type JwtUserInfoClaims ¶
type JwtUserInfoClaims struct { Uid string `json:"uid"` Username string `json:"username"` HeadPic string `json:"headPic"` Email string `json:"email"` Status int `json:"status"` jwt.RegisteredClaims }
func (JwtUserInfoClaims) Valid ¶
func (JwtUserInfoClaims) Valid() error
type MysqlCfgParam ¶
type MysqlCfgParam struct { Host string `toml:"host"` // 数据库地址 127.0.0.1:3306 User string `toml:"user"` // 数据库用户名 Password string `toml:"password"` // 数据库密码 Database string `toml:"database"` // 数据库名 Charset string `toml:"charset"` // 数据库字符集 utf8mb4 ParseTime string `toml:"parseTime"` // 是否分析时间 True Loc string `toml:"loc"` // loc Local }
Mysql 配置参数
type RedisCfgParam ¶
type RedisCfgParam struct { Host string `toml:"host"` // 地址 127.0.0.1:6379 Password string `toml:"password"` // 密码 DB int `toml:"db"` // 默认连接库 }
Redis配置
Click to show internal directories.
Click to hide internal directories.