Documentation
¶
Index ¶
- Constants
- Variables
- func CreateDir(dirs ...string) (err error)
- func Eq(mark string) string
- func Ge(mark string) string
- func GetWriteSyncer() (zapcore.WriteSyncer, error)
- func Gt(mark string) string
- func Le(mark string) string
- func Lt(mark string) string
- func MD5V(str []byte) string
- func Ne(mark string) string
- func NotEmpty() string
- func PathExists(path string) (bool, error)
- func RegisterRule(key string, rule Rules) (err error)
- func Verify(st interface{}, roleMap Rules) (err error)
- type Rules
- type RulesMap
Constants ¶
View Source
const ( ConfigEnv = "GVA_CONFIG" ConfigFile = "config.yaml" )
全局常量
Variables ¶
View Source
var ( IdVerify = Rules{"ID": {NotEmpty()}} ApiVerify = Rules{"Path": {NotEmpty()}, "Description": {NotEmpty()}, "ApiGroup": {NotEmpty()}, "Method": {NotEmpty()}} MenuVerify = Rules{"Path": {NotEmpty()}, "ParentId": {NotEmpty()}, "Name": {NotEmpty()}, "Component": {NotEmpty()}, "Sort": {Ge("0")}} MenuMetaVerify = Rules{"Title": {NotEmpty()}} LoginVerify = Rules{"CaptchaId": {NotEmpty()}, "Captcha": {NotEmpty()}, "Username": {NotEmpty()}, "Password": {NotEmpty()}} RegisterVerify = Rules{"Username": {NotEmpty()}, "NickName": {NotEmpty()}, "Password": {NotEmpty()}, "AuthorityId": {NotEmpty()}} PageInfoVerify = Rules{"Page": {NotEmpty()}, "PageSize": {NotEmpty()}} CustomerVerify = Rules{"CustomerName": {NotEmpty()}, "CustomerPhoneData": {NotEmpty()}} AutoCodeVerify = Rules{"Abbreviation": {NotEmpty()}, "StructName": {NotEmpty()}, "PackageName": {NotEmpty()}, "Fields": {NotEmpty()}} AuthorityVerify = Rules{"AuthorityId": {NotEmpty()}, "AuthorityName": {NotEmpty()}, "ParentId": {NotEmpty()}} AuthorityIdVerify = Rules{"AuthorityId": {NotEmpty()}} OldAuthorityVerify = Rules{"OldAuthorityId": {NotEmpty()}} ChangePasswordVerify = Rules{"Username": {NotEmpty()}, "Password": {NotEmpty()}, "NewPassword": {NotEmpty()}} SetUserAuthorityVerify = Rules{"UUID": {NotEmpty()}, "AuthorityId": {NotEmpty()}} )
请求参非空判断
View Source
var CustomizeMap = make(map[string]Rules)
Functions ¶
func GetWriteSyncer ¶
func GetWriteSyncer() (zapcore.WriteSyncer, error)
GetWriteSyncer: zap logger中加入file-rotatelogs
func RegisterRule ¶
RegisterRule: 注册自定义规则方案建议在路由初始化层即注册
Types ¶
Click to show internal directories.
Click to hide internal directories.