Documentation ¶
Overview ¶
@Time : 2019-09-02 16:51 @Author : Frank @Email : frank@163.com @File : log.go @Software: GoLand
@Time : 2019-09-12 10:38 @Author : Frank @Email : frank@163.com @File : tools.go @Software: GoLand
Index ¶
- Constants
- Variables
- func Contain(obj interface{}, target interface{}) (bool, error)
- func ContainsInt(s []interface{}, e interface{}) bool
- func CopyStruct(src, dst interface{})
- func FindUserInfoAsyc(userInfo string, userChan chan<- UserInfoResp)
- func GetUserInfo(userList []int) map[int]interface{}
- func GetUserInfoAsyc(userList []int, userChan chan<- map[int]interface{})
- func RecodeText(code string) string
- func SetDefaultMessage()
- func StringToMap(str string) (m map[string]interface{})
- func StringToSliceInt(str string) []int
- func StringToSliceMap(str string) (sli []map[string]string)
- func StringToSliceString(str string) []string
- func ToString(sli interface{}) string
- func TransferToStruct(src, dst interface{}) (err error)
- type LoggerConfig
- type User
- type UserInfoResp
- type UserListResp
Constants ¶
View Source
const ( RECODE_OK = "0" RECODE_DBERR = "401" RECODE_NODATA = "402" RECODE_DATAEXIST = "403" RECODE_DATAERR = "404" RECODE_SESSIONERR = "411" RECODE_LOGINERR = "412" RECODE_PARAMERR = "413" RECODE_USERERR = "414" RECODE_ROLEERR = "415" RECODE_PWDERR = "416" RECODE_SMSERR = "417" RECODE_REQERR = "421" RECODE_IPERR = "422" RECODE_THIRDERR = "431" RECODE_IOERR = "432" RECODE_SERVERERR = "450" RECODE_UNKNOWERR = "451" )
Variables ¶
View Source
var MessageTmpls = map[string]string{
"Required": "不能为空",
"Min": "最小为 %d",
"Max": "最大为 %d",
"Range": "范围在 %d 至 %d",
"MinSize": "最小长度为 %d",
"MaxSize": "最大长度为 %d",
"Length": "长度必须是 %d",
"Alpha": "必须是有效的字母字符",
"Numeric": "必须是有效的数字字符",
"AlphaNumeric": "必须是有效的字母或数字字符",
"Match": "必须匹配格式 %s",
"NoMatch": "必须不匹配格式 %s",
"AlphaDash": "必须是有效的字母或数字或破折号(-_)字符",
"Email": "必须是有效的邮件地址",
"IP": "必须是有效的IP地址",
"Base64": "必须是有效的base64字符",
"Mobile": "必须是有效手机号码",
"Tel": "必须是有效电话号码",
"Phone": "必须是有效的电话号码或者手机号码",
"ZipCode": "必须是有效的邮政编码",
}
Functions ¶
func ContainsInt ¶
func ContainsInt(s []interface{}, e interface{}) bool
func FindUserInfoAsyc ¶
func FindUserInfoAsyc(userInfo string, userChan chan<- UserInfoResp)
func GetUserInfo ¶
func GetUserInfoAsyc ¶
func RecodeText ¶
func SetDefaultMessage ¶
func SetDefaultMessage()
func StringToMap ¶
func StringToSliceInt ¶
func StringToSliceMap ¶
func StringToSliceString ¶
Types ¶
type LoggerConfig ¶
type LoggerConfig struct { FileName string `json:"file_name"` Level int `json:"level"` // 日志保存的时候的级别,默认是 Trace 级别 Maxlines int `json:"maxlines"` // 每个文件保存的最大行数,默认值 1000000 Maxsize int `json:"maxsize"` // 每个文件保存的最大尺寸,默认值是 1 << 28, //256 MB Daily bool `json:"daily"` // 是否按照每天 logrotate,默认是 true Maxdays int `json:"maxdays"` // 文件最多保存多少天,默认保存 7 天 Rotate bool `json:"rotate"` // 是否开启 logrotate,默认是 true Perm string `json:"perm"` // 日志文件权限 RotatePerm string `json:"rotateperm"` EnableFuncCallDepth bool `json:"-"` // 输出文件名和行号 LogFuncCallDepth int `json:"-"` // 函数调用层级 Separate string `json:"separate"` }
beego 日志配置结构体
type UserInfoResp ¶
func FindUserInfo ¶
func FindUserInfo(userInfo string) (user UserInfoResp)
type UserListResp ¶
Click to show internal directories.
Click to hide internal directories.