Compare commits
7 Commits
189dc7f57c
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 492e9bae2f | |||
| c4b7f3ce16 | |||
| 8d5895324d | |||
| bf46e2083c | |||
| 42e268aea5 | |||
| 92a7dc3bb9 | |||
| cd7c5fc1f2 |
1
cache.go
1
cache.go
@@ -11,4 +11,5 @@ const (
|
|||||||
CacheDriverRedis = "redis" // redis缓存驱动
|
CacheDriverRedis = "redis" // redis缓存驱动
|
||||||
CacheDriverGocache = "gocache" // gocache缓存驱动
|
CacheDriverGocache = "gocache" // gocache缓存驱动
|
||||||
CacheDriverMemcached = "memcached" // memcache缓存驱动
|
CacheDriverMemcached = "memcached" // memcache缓存驱动
|
||||||
|
CacherDriverNull = "null" // 禁用缓存
|
||||||
)
|
)
|
||||||
|
|||||||
28
data_type.go
28
data_type.go
@@ -96,20 +96,20 @@ var (
|
|||||||
DataTypeMapStrSlice DataType = "map[string][]any" // map -> map[string][]any
|
DataTypeMapStrSlice DataType = "map[string][]any" // map -> map[string][]any
|
||||||
DataTypeMapStrSliceWithMarshal DataType = "map[string][]any_marshal" // map -> map[string][]any, json 序列化之后的结果
|
DataTypeMapStrSliceWithMarshal DataType = "map[string][]any_marshal" // map -> map[string][]any, json 序列化之后的结果
|
||||||
DataTypeAny DataType = "any" // 任意类型 -> any
|
DataTypeAny DataType = "any" // 任意类型 -> any
|
||||||
DataTypeStringPtr DataType = "string_ptr" // *string, 字符串指针
|
DataTypeStringPtr DataType = "*string" // *string, 字符串指针
|
||||||
DataTypeIntPtr DataType = "int_ptr" // *int64, int64指针
|
DataTypeIntPtr DataType = "*int" // *int64, int64指针
|
||||||
DataTypeInt8Ptr DataType = "int8_ptr" // *int8, int8指针
|
DataTypeInt8Ptr DataType = "*int8" // *int8, int8指针
|
||||||
DataTypeInt16Ptr DataType = "int16_ptr" // *int16, int16指针
|
DataTypeInt16Ptr DataType = "*int16" // *int16, int16指针
|
||||||
DataTypeInt32Ptr DataType = "int32_ptr" // *int32, int32指针
|
DataTypeInt32Ptr DataType = "*int32" // *int32, int32指针
|
||||||
DataTypeInt64Ptr DataType = "int64_ptr" // *int64, int64指针
|
DataTypeInt64Ptr DataType = "*int64" // *int64, int64指针
|
||||||
DataTypeUintPtr DataType = "uint_ptr" // *uint64, uint64指针
|
DataTypeUintPtr DataType = "*uint" // *uint64, uint64指针
|
||||||
DataTypeUint8Ptr DataType = "uint8_ptr" // *uint8, uint8指针
|
DataTypeUint8Ptr DataType = "*uint8" // *uint8, uint8指针
|
||||||
DataTypeUint16Ptr DataType = "uint16_ptr" // *uint16, uint16指针
|
DataTypeUint16Ptr DataType = "*uint16" // *uint16, uint16指针
|
||||||
DataTypeUint32Ptr DataType = "uint32_ptr" // *uint32, uint32指针
|
DataTypeUint32Ptr DataType = "*uint32" // *uint32, uint32指针
|
||||||
DataTypeUint64Ptr DataType = "uint64_ptr" // *uint64, uint64指针
|
DataTypeUint64Ptr DataType = "*uint64" // *uint64, uint64指针
|
||||||
DataTypeFloat32Ptr DataType = "float32_ptr" // *float32, float32指针
|
DataTypeFloat32Ptr DataType = "*float32" // *float32, float32指针
|
||||||
DataTypeFloat64Ptr DataType = "float64_ptr" // *float64, float64指针
|
DataTypeFloat64Ptr DataType = "*float64" // *float64, float64指针
|
||||||
DataTypeBoolPtr DataType = "bool_ptr" // *bool, 字符串指针
|
DataTypeBoolPtr DataType = "*bool" // *bool, 字符串指针
|
||||||
DataTypeTime DataType = "time.Time" // time.Time, json类型
|
DataTypeTime DataType = "time.Time" // time.Time, json类型
|
||||||
DataTypeJson DataType = "json" // json, json类型, 特殊的字符串
|
DataTypeJson DataType = "json" // json, json类型, 特殊的字符串
|
||||||
)
|
)
|
||||||
|
|||||||
17
swagger.go
17
swagger.go
@@ -57,3 +57,20 @@ const (
|
|||||||
SwaggerParameterStylePipeDelimited = "pipeDelimited" // in = query , type = array, 管道符`
|
SwaggerParameterStylePipeDelimited = "pipeDelimited" // in = query , type = array, 管道符`
|
||||||
SwaggerParameterStyleDeepObject = "deepObject" // in = query , type = object, 提供一种简单的方法来表示参数中的嵌套对象值.`
|
SwaggerParameterStyleDeepObject = "deepObject" // in = query , type = object, 提供一种简单的方法来表示参数中的嵌套对象值.`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type SwaggerUITheme string
|
||||||
|
|
||||||
|
func (sut SwaggerUITheme) String() string {
|
||||||
|
return string(sut)
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
SwaggerUIThemeDefault SwaggerUITheme = "swaggerUI" // 文档默认主题
|
||||||
|
SwaggerUIThemeKnife4go SwaggerUITheme = "knife4go" // knife4go 主题
|
||||||
|
SwaggerUIThemeYDocLucky SwaggerUITheme = "ydoc-lucky-ui" // YDoc Lucky UI 主题: https://github.com/NoBugBoy/LuckyUI
|
||||||
|
SwaggerUIThemeRedocFree SwaggerUITheme = "redoc-free" // redoc UI 主题, 开源免费版: https://github.com/Redocly/redoc
|
||||||
|
SwaggerUIThemeElements SwaggerUITheme = "elements" // elements 主题, 开源免费版: https://github.com/stoplightio/elements
|
||||||
|
SwaggerUIThemeSwaggerUI SwaggerUITheme = "swagger-ui" // swagger-ui 主题, 开源免费版: https://github.com/ostranme/swagger-ui-themes?tab=readme-ov-file
|
||||||
|
SwaggerUIThemeScalar SwaggerUITheme = "scalar" // scalar 主题, 开源免费版: https://github.com/scalar/scalar
|
||||||
|
SwaggerUIThemeRapiDoc SwaggerUITheme = "rapi-doc" // RapiDoc 主题, 开源免费版: https://github.com/rapi-doc/RapiDoc
|
||||||
|
)
|
||||||
|
|||||||
173
validator.go
173
validator.go
@@ -71,12 +71,10 @@ type ValidatorRuleConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ValidatorRuleSupportDataTypeTable 验证规则支持的数据类型表
|
// ValidatorRuleSupportDataTypeTable 验证规则支持的数据类型表
|
||||||
//
|
var ValidatorRuleSupportDataTypeTable = map[ValidatorRule]ValidatorRuleConfig{}
|
||||||
// Author : go_developer@163.com<白茶清欢>
|
var ValidatorRuleSupportDataTypeList = []ValidatorRuleConfig{
|
||||||
//
|
|
||||||
// Date : 16:13 2025/1/22
|
{
|
||||||
var ValidatorRuleSupportDataTypeTable = map[ValidatorRule]ValidatorRuleConfig{
|
|
||||||
ValidatorRuleEqcsfield: {
|
|
||||||
ValidatorRule: ValidatorRuleEqcsfield,
|
ValidatorRule: ValidatorRuleEqcsfield,
|
||||||
Description: "跨结构体字段相等",
|
Description: "跨结构体字段相等",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber, DataTypeBaseString, DataTypeBaseBool, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber, DataTypeBaseString, DataTypeBaseBool, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
||||||
@@ -84,7 +82,7 @@ var ValidatorRuleSupportDataTypeTable = map[ValidatorRule]ValidatorRuleConfig{
|
|||||||
MaxParamCnt: 1,
|
MaxParamCnt: 1,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidatorRuleEqfield: {
|
{
|
||||||
ValidatorRule: ValidatorRuleEqfield,
|
ValidatorRule: ValidatorRuleEqfield,
|
||||||
Description: "同结构体字段相等",
|
Description: "同结构体字段相等",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber, DataTypeBaseString, DataTypeBaseBool, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber, DataTypeBaseString, DataTypeBaseBool, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
||||||
@@ -92,7 +90,7 @@ var ValidatorRuleSupportDataTypeTable = map[ValidatorRule]ValidatorRuleConfig{
|
|||||||
MaxParamCnt: 1,
|
MaxParamCnt: 1,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidatorRuleFieldcontains: {
|
{
|
||||||
ValidatorRule: ValidatorRuleFieldcontains,
|
ValidatorRule: ValidatorRuleFieldcontains,
|
||||||
Description: "检查指定的字段值是否存在于字段中",
|
Description: "检查指定的字段值是否存在于字段中",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
||||||
@@ -100,7 +98,7 @@ var ValidatorRuleSupportDataTypeTable = map[ValidatorRule]ValidatorRuleConfig{
|
|||||||
MaxParamCnt: 0,
|
MaxParamCnt: 0,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidatorRuleFieldexcludes: {
|
{
|
||||||
ValidatorRule: ValidatorRuleFieldexcludes,
|
ValidatorRule: ValidatorRuleFieldexcludes,
|
||||||
Description: "检查指定的字段值是否不存在于字段中",
|
Description: "检查指定的字段值是否不存在于字段中",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
||||||
@@ -108,7 +106,7 @@ var ValidatorRuleSupportDataTypeTable = map[ValidatorRule]ValidatorRuleConfig{
|
|||||||
MaxParamCnt: 0,
|
MaxParamCnt: 0,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidatorRuleGtcsfield: {
|
{
|
||||||
ValidatorRule: ValidatorRuleGtcsfield,
|
ValidatorRule: ValidatorRuleGtcsfield,
|
||||||
Description: "大于(跨结构体)",
|
Description: "大于(跨结构体)",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
||||||
@@ -116,7 +114,7 @@ var ValidatorRuleSupportDataTypeTable = map[ValidatorRule]ValidatorRuleConfig{
|
|||||||
MaxParamCnt: 1,
|
MaxParamCnt: 1,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidatorRuleGtecsfield: {
|
{
|
||||||
ValidatorRule: ValidatorRuleGtecsfield,
|
ValidatorRule: ValidatorRuleGtecsfield,
|
||||||
Description: "大于(同结构体)",
|
Description: "大于(同结构体)",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
||||||
@@ -124,7 +122,7 @@ var ValidatorRuleSupportDataTypeTable = map[ValidatorRule]ValidatorRuleConfig{
|
|||||||
MaxParamCnt: 1,
|
MaxParamCnt: 1,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidatorRuleGtfield: {
|
{
|
||||||
ValidatorRule: ValidatorRuleGtfield,
|
ValidatorRule: ValidatorRuleGtfield,
|
||||||
Description: "大于(同结构体)",
|
Description: "大于(同结构体)",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
||||||
@@ -132,7 +130,7 @@ var ValidatorRuleSupportDataTypeTable = map[ValidatorRule]ValidatorRuleConfig{
|
|||||||
MaxParamCnt: 1,
|
MaxParamCnt: 1,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidatorRuleGtefield: {
|
{
|
||||||
ValidatorRule: ValidatorRuleGtefield,
|
ValidatorRule: ValidatorRuleGtefield,
|
||||||
Description: "大于(同结构体)",
|
Description: "大于(同结构体)",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
||||||
@@ -140,7 +138,7 @@ var ValidatorRuleSupportDataTypeTable = map[ValidatorRule]ValidatorRuleConfig{
|
|||||||
MaxParamCnt: 1,
|
MaxParamCnt: 1,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidatorRuleLtcsfield: {
|
{
|
||||||
ValidatorRule: ValidatorRuleLtcsfield,
|
ValidatorRule: ValidatorRuleLtcsfield,
|
||||||
Description: "小于(跨结构体)",
|
Description: "小于(跨结构体)",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
||||||
@@ -148,7 +146,7 @@ var ValidatorRuleSupportDataTypeTable = map[ValidatorRule]ValidatorRuleConfig{
|
|||||||
MaxParamCnt: 1,
|
MaxParamCnt: 1,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidatorRuleLtecsfield: {
|
{
|
||||||
ValidatorRule: ValidatorRuleLtecsfield,
|
ValidatorRule: ValidatorRuleLtecsfield,
|
||||||
Description: "小于等于(跨结构体)",
|
Description: "小于等于(跨结构体)",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
||||||
@@ -156,7 +154,7 @@ var ValidatorRuleSupportDataTypeTable = map[ValidatorRule]ValidatorRuleConfig{
|
|||||||
MaxParamCnt: 1,
|
MaxParamCnt: 1,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidatorRuleLtfield: {
|
{
|
||||||
ValidatorRule: ValidatorRuleLtfield,
|
ValidatorRule: ValidatorRuleLtfield,
|
||||||
Description: "小于(同结构体)",
|
Description: "小于(同结构体)",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
||||||
@@ -164,7 +162,7 @@ var ValidatorRuleSupportDataTypeTable = map[ValidatorRule]ValidatorRuleConfig{
|
|||||||
MaxParamCnt: 1,
|
MaxParamCnt: 1,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidatorRuleLtefield: {
|
{
|
||||||
ValidatorRule: ValidatorRuleLtefield,
|
ValidatorRule: ValidatorRuleLtefield,
|
||||||
Description: "小于等于(同结构体)",
|
Description: "小于等于(同结构体)",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
||||||
@@ -172,7 +170,7 @@ var ValidatorRuleSupportDataTypeTable = map[ValidatorRule]ValidatorRuleConfig{
|
|||||||
MaxParamCnt: 1,
|
MaxParamCnt: 1,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidatorRuleNecsfield: {
|
{
|
||||||
ValidatorRule: ValidatorRuleNecsfield,
|
ValidatorRule: ValidatorRuleNecsfield,
|
||||||
Description: "不等于(跨结构体)",
|
Description: "不等于(跨结构体)",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber, DataTypeBaseString, DataTypeBaseBool, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber, DataTypeBaseString, DataTypeBaseBool, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
||||||
@@ -180,7 +178,7 @@ var ValidatorRuleSupportDataTypeTable = map[ValidatorRule]ValidatorRuleConfig{
|
|||||||
MaxParamCnt: 1,
|
MaxParamCnt: 1,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidatorRuleNefield: {
|
{
|
||||||
ValidatorRule: ValidatorRuleNefield,
|
ValidatorRule: ValidatorRuleNefield,
|
||||||
Description: "不等于(同结构体)",
|
Description: "不等于(同结构体)",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber, DataTypeBaseString, DataTypeBaseBool, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber, DataTypeBaseString, DataTypeBaseBool, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
||||||
@@ -188,147 +186,155 @@ var ValidatorRuleSupportDataTypeTable = map[ValidatorRule]ValidatorRuleConfig{
|
|||||||
MaxParamCnt: 1,
|
MaxParamCnt: 1,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidateRuleEq: {
|
{
|
||||||
ValidatorRule: ValidateRuleEq,
|
ValidatorRule: ValidatorRuleEq,
|
||||||
Description: "等于(严格校验)",
|
Description: "等于(严格校验)",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber, DataTypeBaseString, DataTypeBaseBool, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber, DataTypeBaseString, DataTypeBaseBool, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
||||||
MinParamCnt: 1,
|
MinParamCnt: 1,
|
||||||
MaxParamCnt: 1,
|
MaxParamCnt: 1,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidateRuleEqIgnoreCase: {
|
{
|
||||||
ValidatorRule: ValidateRuleEqIgnoreCase,
|
ValidatorRule: ValidatorRuleEqIgnoreCase,
|
||||||
Description: "等于(忽略大小写)",
|
Description: "等于(忽略大小写)",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber, DataTypeBaseString, DataTypeBaseBool, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber, DataTypeBaseString, DataTypeBaseBool, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
||||||
MinParamCnt: 1,
|
MinParamCnt: 1,
|
||||||
MaxParamCnt: 1,
|
MaxParamCnt: 1,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidateRuleGt: {
|
{
|
||||||
ValidatorRule: ValidateRuleGt,
|
ValidatorRule: ValidatorRuleGt,
|
||||||
Description: "大于",
|
Description: "大于",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
||||||
MinParamCnt: 1,
|
MinParamCnt: 1,
|
||||||
MaxParamCnt: 0,
|
MaxParamCnt: 0,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidateRuleGte: {
|
{
|
||||||
ValidatorRule: ValidateRuleGte,
|
ValidatorRule: ValidatorRuleGte,
|
||||||
Description: "大于等于",
|
Description: "大于等于",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
||||||
MinParamCnt: 1,
|
MinParamCnt: 1,
|
||||||
MaxParamCnt: 0,
|
MaxParamCnt: 0,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidateRuleLt: {
|
{
|
||||||
ValidatorRule: ValidateRuleLt,
|
ValidatorRule: ValidatorRuleLt,
|
||||||
Description: "小于",
|
Description: "小于",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
||||||
MinParamCnt: 1,
|
MinParamCnt: 1,
|
||||||
MaxParamCnt: 0,
|
MaxParamCnt: 0,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidateRuleLte: {
|
{
|
||||||
ValidatorRule: ValidateRuleLte,
|
ValidatorRule: ValidatorRuleLte,
|
||||||
Description: "小于等于",
|
Description: "小于等于",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
||||||
MinParamCnt: 1,
|
MinParamCnt: 1,
|
||||||
MaxParamCnt: 0,
|
MaxParamCnt: 0,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidateRuleNe: {
|
{
|
||||||
ValidatorRule: ValidateRuleNe,
|
ValidatorRule: ValidatorRuleNe,
|
||||||
Description: "不等于(严格判断)",
|
Description: "不等于(严格判断)",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber, DataTypeBaseString, DataTypeBaseBool, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber, DataTypeBaseString, DataTypeBaseBool, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
||||||
MinParamCnt: 1,
|
MinParamCnt: 1,
|
||||||
MaxParamCnt: 0,
|
MaxParamCnt: 0,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidateRuleNeIgnoreCase: {
|
{
|
||||||
ValidatorRule: ValidateRuleNeIgnoreCase,
|
ValidatorRule: ValidatorRuleNeIgnoreCase,
|
||||||
Description: "不等于(忽略大小写)",
|
Description: "不等于(忽略大小写)",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber, DataTypeBaseString, DataTypeBaseBool, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber, DataTypeBaseString, DataTypeBaseBool, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
||||||
MinParamCnt: 1,
|
MinParamCnt: 1,
|
||||||
MaxParamCnt: 0,
|
MaxParamCnt: 0,
|
||||||
ParamCntMustEven: false,
|
ParamCntMustEven: false,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonDir: {
|
{
|
||||||
|
ValidatorRule: ValidatorRuleRegexp,
|
||||||
|
Description: "正则表达式",
|
||||||
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString),
|
||||||
|
MinParamCnt: 1,
|
||||||
|
MaxParamCnt: 1,
|
||||||
|
ParamCntMustEven: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonDir,
|
ValidatorRule: ValidatorRuleCommonDir,
|
||||||
Description: "文件夹存在",
|
Description: "文件夹存在",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
||||||
WithoutParam: true,
|
WithoutParam: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonDirPath: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonDirPath,
|
ValidatorRule: ValidatorRuleCommonDirPath,
|
||||||
Description: "文件夹路径存在",
|
Description: "文件夹路径存在",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
||||||
WithoutParam: true,
|
WithoutParam: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonFile: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonFile,
|
ValidatorRule: ValidatorRuleCommonFile,
|
||||||
Description: "文件存在",
|
Description: "文件存在",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
||||||
WithoutParam: true,
|
WithoutParam: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonFilepath: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonFilepath,
|
ValidatorRule: ValidatorRuleCommonFilepath,
|
||||||
Description: "文件路径存在",
|
Description: "文件路径存在",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
||||||
WithoutParam: true,
|
WithoutParam: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonImage: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonImage,
|
ValidatorRule: ValidatorRuleCommonImage,
|
||||||
Description: "是否图像资源",
|
Description: "是否图像资源",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal),
|
||||||
WithoutParam: true,
|
WithoutParam: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonIsDefault: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonIsDefault,
|
ValidatorRule: ValidatorRuleCommonIsDefault,
|
||||||
Description: "是否对应类型默认值",
|
Description: "是否对应类型默认值",
|
||||||
SupportDataTypeList: nil, // 所有类型均支持
|
SupportDataTypeList: nil, // 所有类型均支持
|
||||||
WithoutParam: true,
|
WithoutParam: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonOmitempty: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonOmitempty,
|
ValidatorRule: ValidatorRuleCommonOmitempty,
|
||||||
Description: "为空时不进行其他校验",
|
Description: "为空时不进行其他校验",
|
||||||
SupportDataTypeList: nil, // 所有类型均支持
|
SupportDataTypeList: nil, // 所有类型均支持
|
||||||
WithoutParam: true,
|
WithoutParam: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonLen: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonLen,
|
ValidatorRule: ValidatorRuleCommonLen,
|
||||||
Description: "数据长度",
|
Description: "数据长度",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal, DataTypeSlice, DataTypeMap), // 所有类型均支持
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString, DataTypeSliceMarshal, DataTypeSliceSplit, DataTypeMapMarshal, DataTypeSlice, DataTypeMap), // 所有类型均支持
|
||||||
MinParamCnt: 1,
|
MinParamCnt: 1,
|
||||||
MaxParamCnt: 1,
|
MaxParamCnt: 1,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonMax: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonMax,
|
ValidatorRule: ValidatorRuleCommonMax,
|
||||||
Description: "最大值",
|
Description: "最大值",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
||||||
MinParamCnt: 1,
|
MinParamCnt: 1,
|
||||||
MaxParamCnt: 1,
|
MaxParamCnt: 1,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonMin: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonMin,
|
ValidatorRule: ValidatorRuleCommonMin,
|
||||||
Description: "最小值",
|
Description: "最小值",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
||||||
MinParamCnt: 1,
|
MinParamCnt: 1,
|
||||||
MaxParamCnt: 1,
|
MaxParamCnt: 1,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonOneOf: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonOneOf,
|
ValidatorRule: ValidatorRuleCommonOneOf,
|
||||||
Description: "枚举值",
|
Description: "枚举值",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber, DataTypeBaseString, DataTypeBaseBool),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber, DataTypeBaseString, DataTypeBaseBool),
|
||||||
MinParamCnt: 1,
|
MinParamCnt: 1,
|
||||||
MaxParamCnt: 0,
|
MaxParamCnt: 0,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonRequired: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonRequired,
|
ValidatorRule: ValidatorRuleCommonRequired,
|
||||||
Description: "必传校验",
|
Description: "必传校验",
|
||||||
SupportDataTypeList: nil, // 所有类型均支持
|
SupportDataTypeList: nil, // 所有类型均支持
|
||||||
WithoutParam: true,
|
WithoutParam: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonRequiredIf: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonRequiredIf,
|
ValidatorRule: ValidatorRuleCommonRequiredIf,
|
||||||
Description: "当指定字段等于给定值时, 必传校验",
|
Description: "当指定字段等于给定值时, 必传校验",
|
||||||
SupportDataTypeList: nil, // 所有类型均支持
|
SupportDataTypeList: nil, // 所有类型均支持
|
||||||
@@ -336,7 +342,7 @@ var ValidatorRuleSupportDataTypeTable = map[ValidatorRule]ValidatorRuleConfig{
|
|||||||
MaxParamCnt: 0,
|
MaxParamCnt: 0,
|
||||||
ParamCntMustEven: true,
|
ParamCntMustEven: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonRequiredUnless: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonRequiredUnless,
|
ValidatorRule: ValidatorRuleCommonRequiredUnless,
|
||||||
Description: "当指定字段不等于给定值时, 必传校验",
|
Description: "当指定字段不等于给定值时, 必传校验",
|
||||||
SupportDataTypeList: nil, // 所有类型均支持
|
SupportDataTypeList: nil, // 所有类型均支持
|
||||||
@@ -344,40 +350,40 @@ var ValidatorRuleSupportDataTypeTable = map[ValidatorRule]ValidatorRuleConfig{
|
|||||||
MaxParamCnt: 0,
|
MaxParamCnt: 0,
|
||||||
ParamCntMustEven: true,
|
ParamCntMustEven: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonRequiredWith: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonRequiredWith,
|
ValidatorRule: ValidatorRuleCommonRequiredWith,
|
||||||
Description: "当任意一个指定字段不为零值时, 必传校验",
|
Description: "当任意一个指定字段不为零值时, 必传校验",
|
||||||
SupportDataTypeList: nil, // 所有类型均支持
|
SupportDataTypeList: nil, // 所有类型均支持
|
||||||
MinParamCnt: 1,
|
MinParamCnt: 1,
|
||||||
MaxParamCnt: 0,
|
MaxParamCnt: 0,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonRequiredWithAll: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonRequiredWithAll,
|
ValidatorRule: ValidatorRuleCommonRequiredWithAll,
|
||||||
Description: "当全部指定字段不为零值时, 必传校验",
|
Description: "当全部指定字段不为零值时, 必传校验",
|
||||||
SupportDataTypeList: nil, // 所有类型均支持
|
SupportDataTypeList: nil, // 所有类型均支持
|
||||||
MinParamCnt: 1,
|
MinParamCnt: 1,
|
||||||
MaxParamCnt: 0,
|
MaxParamCnt: 0,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonRequiredWithout: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonRequiredWithout,
|
ValidatorRule: ValidatorRuleCommonRequiredWithout,
|
||||||
Description: "当任意一个字段不存在时, 必传校验",
|
Description: "当任意一个字段不存在时, 必传校验",
|
||||||
SupportDataTypeList: nil, // 所有类型均支持
|
SupportDataTypeList: nil, // 所有类型均支持
|
||||||
MinParamCnt: 1,
|
MinParamCnt: 1,
|
||||||
MaxParamCnt: 0,
|
MaxParamCnt: 0,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonRequiredWithoutAll: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonRequiredWithoutAll,
|
ValidatorRule: ValidatorRuleCommonRequiredWithoutAll,
|
||||||
Description: "当全部字段不存在时, 必传校验",
|
Description: "当全部字段不存在时, 必传校验",
|
||||||
SupportDataTypeList: nil, // 所有类型均支持
|
SupportDataTypeList: nil, // 所有类型均支持
|
||||||
MinParamCnt: 1,
|
MinParamCnt: 1,
|
||||||
MaxParamCnt: 0,
|
MaxParamCnt: 0,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonExcludedIf: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonExcludedIf,
|
ValidatorRule: ValidatorRuleCommonExcludedIf,
|
||||||
Description: "当指定字段等于给定值时,排除校验",
|
Description: "当指定字段等于给定值时,排除校验",
|
||||||
SupportDataTypeList: nil, // 所有类型均支持
|
SupportDataTypeList: nil, // 所有类型均支持
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonExcludedUnless: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonExcludedUnless,
|
ValidatorRule: ValidatorRuleCommonExcludedUnless,
|
||||||
Description: "当指定字段等于给定值时,排除校验",
|
Description: "当指定字段等于给定值时,排除校验",
|
||||||
SupportDataTypeList: nil, // 所有类型均支持
|
SupportDataTypeList: nil, // 所有类型均支持
|
||||||
@@ -385,7 +391,7 @@ var ValidatorRuleSupportDataTypeTable = map[ValidatorRule]ValidatorRuleConfig{
|
|||||||
MaxParamCnt: 0,
|
MaxParamCnt: 0,
|
||||||
ParamCntMustEven: true,
|
ParamCntMustEven: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonExcludedWith: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonExcludedWith,
|
ValidatorRule: ValidatorRuleCommonExcludedWith,
|
||||||
Description: "当全部指定字段不为零值时,排除校验",
|
Description: "当全部指定字段不为零值时,排除校验",
|
||||||
SupportDataTypeList: nil, // 所有类型均支持
|
SupportDataTypeList: nil, // 所有类型均支持
|
||||||
@@ -393,94 +399,94 @@ var ValidatorRuleSupportDataTypeTable = map[ValidatorRule]ValidatorRuleConfig{
|
|||||||
MaxParamCnt: 0,
|
MaxParamCnt: 0,
|
||||||
ParamCntMustEven: true,
|
ParamCntMustEven: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonExcludedWithAll: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonExcludedWithAll,
|
ValidatorRule: ValidatorRuleCommonExcludedWithAll,
|
||||||
Description: "当全部指定字段不为零值时,排除校验",
|
Description: "当全部指定字段不为零值时,排除校验",
|
||||||
SupportDataTypeList: nil, // 所有类型均支持
|
SupportDataTypeList: nil, // 所有类型均支持
|
||||||
MinParamCnt: 1,
|
MinParamCnt: 1,
|
||||||
MaxParamCnt: 0,
|
MaxParamCnt: 0,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonExcludedWithout: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonExcludedWithout,
|
ValidatorRule: ValidatorRuleCommonExcludedWithout,
|
||||||
Description: "当任意一个指定字段不存在时,排除校验",
|
Description: "当任意一个指定字段不存在时,排除校验",
|
||||||
SupportDataTypeList: nil, // 所有类型均支持
|
SupportDataTypeList: nil, // 所有类型均支持
|
||||||
MinParamCnt: 1,
|
MinParamCnt: 1,
|
||||||
MaxParamCnt: 0,
|
MaxParamCnt: 0,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonExcludedWithoutAll: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonExcludedWithoutAll,
|
ValidatorRule: ValidatorRuleCommonExcludedWithoutAll,
|
||||||
Description: "当全部指定字段不存在时,排除校验",
|
Description: "当全部指定字段不存在时,排除校验",
|
||||||
SupportDataTypeList: nil, // 所有类型均支持
|
SupportDataTypeList: nil, // 所有类型均支持
|
||||||
MinParamCnt: 1,
|
MinParamCnt: 1,
|
||||||
MaxParamCnt: 0,
|
MaxParamCnt: 0,
|
||||||
},
|
},
|
||||||
ValidatorRuleCommonUnique: {
|
{
|
||||||
ValidatorRule: ValidatorRuleCommonUnique,
|
ValidatorRule: ValidatorRuleCommonUnique,
|
||||||
Description: "是否唯一, 用于切片验证",
|
Description: "是否唯一, 用于切片验证",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeSlice), // 所有类型均支持
|
SupportDataTypeList: getMergeDataTypeList(DataTypeSlice), // 所有类型均支持
|
||||||
WithoutParam: true,
|
WithoutParam: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleFormatterCron: {
|
{
|
||||||
ValidatorRule: ValidatorRuleFormatterCron,
|
ValidatorRule: ValidatorRuleFormatterCron,
|
||||||
Description: "cron表达式验证",
|
Description: "cron表达式验证",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString),
|
||||||
WithoutParam: true,
|
WithoutParam: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleFormatterEmail: {
|
{
|
||||||
ValidatorRule: ValidatorRuleFormatterEmail,
|
ValidatorRule: ValidatorRuleFormatterEmail,
|
||||||
Description: "邮箱地址验证",
|
Description: "邮箱地址验证",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString),
|
||||||
WithoutParam: true,
|
WithoutParam: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleFormatterJson: {
|
{
|
||||||
ValidatorRule: ValidatorRuleFormatterJson,
|
ValidatorRule: ValidatorRuleFormatterJson,
|
||||||
Description: "json格式验证",
|
Description: "json格式验证",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString),
|
||||||
WithoutParam: true,
|
WithoutParam: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleFormatterJwt: {
|
{
|
||||||
ValidatorRule: ValidatorRuleFormatterJson,
|
ValidatorRule: ValidatorRuleFormatterJson,
|
||||||
Description: "JWT(JSON Web Token)验证",
|
Description: "JWT(JSON Web Token)验证",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString),
|
||||||
WithoutParam: true,
|
WithoutParam: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleFormatterLatitude: {
|
{
|
||||||
ValidatorRule: ValidatorRuleFormatterLatitude,
|
ValidatorRule: ValidatorRuleFormatterLatitude,
|
||||||
Description: "纬度验证",
|
Description: "纬度验证",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
||||||
WithoutParam: true,
|
WithoutParam: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleFormatterLongitude: {
|
{
|
||||||
ValidatorRule: ValidatorRuleFormatterLongitude,
|
ValidatorRule: ValidatorRuleFormatterLongitude,
|
||||||
Description: "经度验证",
|
Description: "经度验证",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseNumber),
|
||||||
WithoutParam: true,
|
WithoutParam: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleFormatterTimezone: {
|
{
|
||||||
ValidatorRule: ValidatorRuleFormatterLongitude,
|
ValidatorRule: ValidatorRuleFormatterLongitude,
|
||||||
Description: "时区验证",
|
Description: "时区验证",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString),
|
||||||
WithoutParam: true,
|
WithoutParam: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleFormatterUrl: {
|
{
|
||||||
ValidatorRule: ValidatorRuleFormatterUrl,
|
ValidatorRule: ValidatorRuleFormatterUrl,
|
||||||
Description: "url验证",
|
Description: "url验证",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString),
|
||||||
WithoutParam: true,
|
WithoutParam: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleFormatterUri: {
|
{
|
||||||
ValidatorRule: ValidatorRuleFormatterUrl,
|
ValidatorRule: ValidatorRuleFormatterUrl,
|
||||||
Description: "uri验证",
|
Description: "uri验证",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString),
|
||||||
WithoutParam: true,
|
WithoutParam: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleFormatterLowercase: {
|
{
|
||||||
ValidatorRule: ValidatorRuleFormatterLowercase,
|
ValidatorRule: ValidatorRuleFormatterLowercase,
|
||||||
Description: "仅包含小写字符",
|
Description: "仅包含小写字符",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString),
|
||||||
WithoutParam: true,
|
WithoutParam: true,
|
||||||
},
|
},
|
||||||
ValidatorRuleFormatterUppercase: {
|
{
|
||||||
ValidatorRule: ValidatorRuleFormatterUppercase,
|
ValidatorRule: ValidatorRuleFormatterUppercase,
|
||||||
Description: "仅包含大写字符",
|
Description: "仅包含大写字符",
|
||||||
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString),
|
SupportDataTypeList: getMergeDataTypeList(DataTypeBaseString),
|
||||||
@@ -488,6 +494,12 @@ var ValidatorRuleSupportDataTypeTable = map[ValidatorRule]ValidatorRuleConfig{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
for _, item := range ValidatorRuleSupportDataTypeList {
|
||||||
|
ValidatorRuleSupportDataTypeTable[item.ValidatorRule] = item
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// ValidatorRuleEqcsfield .....Fields ..............
|
// ValidatorRuleEqcsfield .....Fields ..............
|
||||||
ValidatorRuleEqcsfield ValidatorRule = "eqcsfield" // 跨结构体字段相等 eqcsfield={{struct.field}}
|
ValidatorRuleEqcsfield ValidatorRule = "eqcsfield" // 跨结构体字段相等 eqcsfield={{struct.field}}
|
||||||
@@ -505,15 +517,16 @@ var (
|
|||||||
ValidatorRuleNecsfield ValidatorRule = "necsfield" // 不等于(跨结构体) necsfield={{struct.field}}
|
ValidatorRuleNecsfield ValidatorRule = "necsfield" // 不等于(跨结构体) necsfield={{struct.field}}
|
||||||
ValidatorRuleNefield ValidatorRule = "nefield" // 不等于(同结构体) nefield={{struct.field}}
|
ValidatorRuleNefield ValidatorRule = "nefield" // 不等于(同结构体) nefield={{struct.field}}
|
||||||
|
|
||||||
// ValidateRuleEq Comparisons ....................
|
// ValidatorRuleEq Comparisons ....................
|
||||||
ValidateRuleEq ValidatorRule = "eq" // 相等(严格判断) eq={{any_value}}
|
ValidatorRuleEq ValidatorRule = "eq" // 相等(严格判断) eq={{any_value}}
|
||||||
ValidateRuleEqIgnoreCase ValidatorRule = "eq_ignore_case" // 相等(忽略大小写) eq_ignore_case={{any_value}}
|
ValidatorRuleEqIgnoreCase ValidatorRule = "eq_ignore_case" // 相等(忽略大小写) eq_ignore_case={{any_value}}
|
||||||
ValidateRuleGt ValidatorRule = "gt" // 大于 gt={{number_value}}
|
ValidatorRuleGt ValidatorRule = "gt" // 大于 gt={{number_value}}
|
||||||
ValidateRuleGte ValidatorRule = "gte" // 大于等于 gte={{number_value}}
|
ValidatorRuleGte ValidatorRule = "gte" // 大于等于 gte={{number_value}}
|
||||||
ValidateRuleLt ValidatorRule = "lt" // 小于 lt={{number_value}}
|
ValidatorRuleLt ValidatorRule = "lt" // 小于 lt={{number_value}}
|
||||||
ValidateRuleLte ValidatorRule = "lte" // 小于等于 lte={{number_value}}
|
ValidatorRuleLte ValidatorRule = "lte" // 小于等于 lte={{number_value}}
|
||||||
ValidateRuleNe ValidatorRule = "ne" // 不相等(严格判断) ne={{any_value}}
|
ValidatorRuleNe ValidatorRule = "ne" // 不相等(严格判断) ne={{any_value}}
|
||||||
ValidateRuleNeIgnoreCase ValidatorRule = "ne_ignore_case" // 不相等(忽略大小写) ne_ignore_case={{any_value}}
|
ValidatorRuleNeIgnoreCase ValidatorRule = "ne_ignore_case" // 不相等(忽略大小写) ne_ignore_case={{any_value}}
|
||||||
|
ValidatorRuleRegexp ValidatorRule = "regexp" // 正则表达式
|
||||||
|
|
||||||
// ValidatorRuleCommonDir ............others
|
// ValidatorRuleCommonDir ............others
|
||||||
ValidatorRuleCommonDir ValidatorRule = "dir" // 文件夹存在
|
ValidatorRuleCommonDir ValidatorRule = "dir" // 文件夹存在
|
||||||
|
|||||||
Reference in New Issue
Block a user