Documentation ¶
Index ¶
- Constants
- func BoolPointerToString(v *bool) string
- func BoolToString(v bool) string
- func BuildErrorReason(tagInfo *TagInfo, fieldDesc string) string
- func EnumPointerToString(v interface{}) string
- func FieldError1(structName string, reason string, value string) error
- func FieldError2(structName string, reason string) error
- func Float32PointerToString(v *float32) string
- func Float32ToString(v float32) string
- func Float64PointerToString(v *float64) string
- func Float64ToString(v float64) string
- func Int32PointerToString(v *int32) string
- func Int32ToString(v int32) string
- func Int64PointerToString(v *int64) string
- func Int64ToString(v int64) string
- func InvokeValidatorIfExists(candidate interface{}) error
- func SliceIsUniqueBool(a []bool) bool
- func SliceIsUniqueBytes(a [][]byte) bool
- func SliceIsUniqueEnum(a interface{}) bool
- func SliceIsUniqueFloat32(a []float32) bool
- func SliceIsUniqueFloat64(a []float64) bool
- func SliceIsUniqueInt32(a []int32) bool
- func SliceIsUniqueInt64(a []int64) bool
- func SliceIsUniqueMessage(a interface{}) bool
- func SliceIsUniqueString(a []string) bool
- func SliceIsUniqueUint32(a []uint32) bool
- func SliceIsUniqueUint64(a []uint64) bool
- func StringByteLenToString(s string) string
- func StringCharsetLenToString(s string) string
- func StringIsAlpha(s string) bool
- func StringIsAlphaNumber(s string) bool
- func StringIsAscii(s string) bool
- func StringIsBase64(s string) bool
- func StringIsBase64URL(s string) bool
- func StringIsBoolean(s string) bool
- func StringIsCIDR(s string) bool
- func StringIsCIDRv4(s string) bool
- func StringIsCIDRv6(s string) bool
- func StringIsDataURI(s string) bool
- func StringIsDatetime(s string, layout string) bool
- func StringIsEmail(s string) bool
- func StringIsFQDN(s string) bool
- func StringIsHTML(s string) bool
- func StringIsHTMLEncoded(s string) bool
- func StringIsHexadecimal(s string) bool
- func StringIsHostname(s string) bool
- func StringIsHostnamePort(s string) bool
- func StringIsHostnameRFC1123(s string) bool
- func StringIsIP(s string) bool
- func StringIsIP4Addr(s string) bool
- func StringIsIP6Addr(s string) bool
- func StringIsIPAddr(s string) bool
- func StringIsIPv4(s string) bool
- func StringIsIPv6(s string) bool
- func StringIsJSON(s string) bool
- func StringIsJWT(s string) bool
- func StringIsLowercase(s string) bool
- func StringIsMAC(s string) bool
- func StringIsNumber(s string) bool
- func StringIsPrintAscii(s string) bool
- func StringIsTCP4Addr(s string) bool
- func StringIsTCP6Addr(s string) bool
- func StringIsTCPAddr(s string) bool
- func StringIsTimezone(s string) bool
- func StringIsUDP4Addr(s string) bool
- func StringIsUDP6Addr(s string) bool
- func StringIsUDPAddr(s string) bool
- func StringIsURI(s string) bool
- func StringIsURL(s string) bool
- func StringIsURLEncoded(s string) bool
- func StringIsUUID(s string) bool
- func StringIsUUID1(s string) bool
- func StringIsUUID3(s string) bool
- func StringIsUUID4(s string) bool
- func StringIsUUID5(s string) bool
- func StringIsUnixAddr(s string) bool
- func StringIsUnixCron(s string) bool
- func StringIsUppercase(s string) bool
- func StringPointerByteLenToString(s *string) string
- func StringPointerCharsetLenToString(s *string) string
- func StringPointerToString(v *string) string
- func Uint32PointerToString(v *uint32) string
- func Uint32ToString(v uint32) string
- func Uint64PointerToString(v *uint64) string
- func Uint64ToString(v uint64) string
- type TagInfo
- type ValidateError
- type Validator
Constants ¶
const ( TagFloatEq = "float.eq" TagFloatNe = "float.ne" TagFloatGt = "float.gt" TagFloatLt = "float.lt" TagFloatGte = "float.gte" TagFloatLte = "float.lte" TagFloatIn = "float.in" TagFloatNotIn = "float.not_in" )
tag const for float.
const ( TagIntEq = "int.eq" TagIntNe = "int.ne" TagIntGt = "int.gt" TagIntLt = "int.lt" TagIntGte = "int.gte" TagIntLte = "int.lte" TagIntIn = "int.in" TagIntNotIn = "int.not_in" )
tag const for int.
const ( TagUintEq = "uint.eq" TagUintNe = "uint.ne" TagUintGt = "uint.gt" TagUintLt = "uint.lt" TagUintGte = "uint.gte" TagUintLte = "uint.lte" TagUintIn = "uint.in" TagUintNotIn = "uint.not_in" )
tag const for uint.
const ( TagStringEq = "string.eq" TagStringNe = "string.ne" TagStringGt = "string.gt" TagStringLt = "string.lt" TagStringGte = "string.gte" TagStringLte = "string.lte" TagStringIn = "string.in" TagStringNotIn = "string.not_in" TagStringCharLenEq = "string.char_len_eq" TagStringCharLenNe = "string.char_len_ne" TagStringCharLenGt = "string.char_len_gt" TagStringCharLenLt = "string.char_len_lt" TagStringCharLenGte = "string.char_len_gte" TagStringCharLenLte = "string.char_len_lte" TagStringByteLenEq = "string.byte_len_eq" TagStringByteLenNe = "string.byte_len_ne" TagStringByteLenGt = "string.byte_len_gt" TagStringByteLenLt = "string.byte_len_lt" TagStringByteLenGte = "string.byte_len_gte" TagStringByteLenLte = "string.byte_len_lte" TagStringRegex = "string.regex" TagStringPrefix = "string.prefix" TagStringNoPrefix = "string.no_prefix" TagStringSuffix = "string.suffix" TagStringNoSuffix = "string.no_suffix" TagStringContains = "string.contains" TagStringNotContains = "string.not_contains" TagStringContainsAny = "string.contains_any" TagStringNotContainsAny = "string.not_contains_any" TagStringUTF8 = "string.utf8" TagStringAscii = "string.ascii" TagStringPrintAscii = "string.print_ascii" TagStringBoolean = "string.boolean" TagStringLowercase = "string.lowercase" TagStringUppercase = "string.uppercase" TagStringAlpha = "string.alpha" TagStringNumber = "string.number" TagStringAlphaNumber = "string.alpha_number" TagStringIp = "string.ip" TagStringIpv4 = "string.ipv4" TagStringIpv6 = "string.ipv6" TagStringIpAddr = "string.ip_addr" TagStringIp4Addr = "string.ip4_addr" TagStringIp6Addr = "string.ip6_addr" TagStringCidr = "string.cidr" TagStringCidrv4 = "string.cidrv4" TagStringCidrv6 = "string.cidrv6" TagStringMac = "string.mac" TagStringTcpAddr = "string.tcp_addr" TagStringTcp4Addr = "string.tcp4_addr" TagStringTcp6Addr = "string.tcp6_addr" TagStringUdpAddr = "string.udp_addr" TagStringUdp4Addr = "string.udp4_addr" TagStringUdp6Addr = "string.udp6_addr" TagStringUnixAddr = "string.unix_addr" TagStringHostname = "string.hostname" TagStringHostnameRfc1123 = "string.hostname_rfc1123" TagStringHostnamePort = "string.hostname_port" TagStringDataURI = "string.data_uri" TagStringFQDN = "string.fqdn" TagStringURI = "string.uri" TagStringURL = "string.url" TagStringURLEncoded = "string.url_encoded" TagStringUnixCron = "string.unix_cron" TagStringEmail = "string.email" TagStringJSON = "string.json" TagStringJWT = "string.jwt" TagStringHTML = "string.html" TagStringHTMLEncoded = "string.html_encoded" TagStringBase64 = "string.base64" TagStringBase64URL = "string.base64_url" TagStringHexadecimal = "string.hexadecimal" TagStringDatetime = "string.datetime" TagStringTimezone = "string.timezone" TagStringUUID = "string.uuid" TagStringUUID1 = "string.uuid1" TagStringUUID3 = "string.uuid3" TagStringUUID4 = "string.uuid4" TagStringUUID5 = "string.uuid5" )
tag const for string.
const ( TagBytesLenEq = "bytes.len_eq" TagBytesLenNe = "bytes.len_ne" TagBytesLenGt = "bytes.len_gt" TagBytesLenLt = "bytes.len_lt" TagBytesLenGte = "bytes.len_gte" TagBytesLenLte = "bytes.len_lte" )
tag const for bytes.
const ( TagEnumEq = "enum.eq" TagEnumNe = "enum.ne" TagEnumGt = "enum.gt" TagEnumLt = "enum.lt" TagEnumGte = "enum.gte" TagEnumLte = "enum.lte" TagEnumIn = "enum.in" TagEnumNotIn = "enum.not_in" TagEnumInEnums = "enum.in_enums" )
tag const for enum.
const ( TagMessageNotNull = "message.not_null" TagMessageSkip = "message.skip" )
tag const for message.
const ( TagRepeatedNotNull = "repeated.not_null" TagRepeatedLenEq = "repeated.len_eq" TagRepeatedLenNe = "repeated.len_ne" TagRepeatedLenGt = "repeated.len_gt" TagRepeatedLenLt = "repeated.len_lt" TagRepeatedLenGte = "repeated.len_gte" TagRepeatedLenLte = "repeated.len_lte" TagRepeatedUnique = "repeated.unique" TagRepeatedItem = "repeated.item" )
tag const for repeated.
const ( TagMapNotNull = "map.not_null" TagMapLenEq = "map.len_eq" TagMapLenNe = "map.len_ne" TagMapLenGt = "map.len_gt" TagMapLenLt = "map.len_lt" TagMapLenGte = "map.len_gte" TagMapLenLte = "map.len_lte" TagMapKey = "map.key" TagMapValue = "map.value" )
tag const for map.
const (
TagBoolEq = "bool.eq"
)
tag const for bool.
const (
TagOneOfNotNull = "oneof.not_null"
)
tag const for oneof
Variables ¶
This section is empty.
Functions ¶
func BoolPointerToString ¶
func BoolToString ¶
func BuildErrorReason ¶
func EnumPointerToString ¶
func EnumPointerToString(v interface{}) string
func FieldError2 ¶
func Float32PointerToString ¶
func Float32ToString ¶
func Float64PointerToString ¶
func Float64ToString ¶
func Int32PointerToString ¶
func Int32ToString ¶
func Int64PointerToString ¶
func Int64ToString ¶
func InvokeValidatorIfExists ¶
func InvokeValidatorIfExists(candidate interface{}) error
InvokeValidatorIfExists for invoke the Validate method if a interface is a Validator.
func SliceIsUniqueBool ¶
func SliceIsUniqueBytes ¶
func SliceIsUniqueEnum ¶
func SliceIsUniqueEnum(a interface{}) bool
func SliceIsUniqueFloat32 ¶
func SliceIsUniqueFloat64 ¶
func SliceIsUniqueInt32 ¶
func SliceIsUniqueInt64 ¶
func SliceIsUniqueMessage ¶
func SliceIsUniqueMessage(a interface{}) bool
func SliceIsUniqueString ¶
func SliceIsUniqueUint32 ¶
func SliceIsUniqueUint64 ¶
func StringByteLenToString ¶
func StringIsAlphaNumber ¶
func StringIsAscii ¶
StringIsAscii check whether the string is ascii charset.
func StringIsBase64 ¶
func StringIsBase64URL ¶
func StringIsBoolean ¶
func StringIsCIDR ¶
StringIsCIDR is the validation function for validating if the field's value is a valid v4 or v6 CIDR address.
func StringIsCIDRv4 ¶
StringIsCIDRv4 is the validation function for validating if the field's value is a valid v4 CIDR address.
func StringIsCIDRv6 ¶
StringIsCIDRv6 is the validation function for validating if the field's value is a valid v6 CIDR address.
func StringIsDataURI ¶
StringIsDataURI is the validation function for validating if the field's value is a valid data URI.
func StringIsDatetime ¶
func StringIsEmail ¶
func StringIsFQDN ¶
func StringIsHTML ¶
func StringIsHTMLEncoded ¶
func StringIsHexadecimal ¶
func StringIsHostname ¶
func StringIsHostnamePort ¶
func StringIsHostnameRFC1123 ¶
func StringIsIP ¶
StringIsIP is the validation function for validating if the field's value is a valid v4 or v6 IP address.
func StringIsIP4Addr ¶
StringIsIP4Addr is the validation function for validating if the field's value is a resolvable ip4 address.
func StringIsIP6Addr ¶
StringIsIP6Addr is the validation function for validating if the field's value is a resolvable ip6 address.
func StringIsIPAddr ¶
StringIsIPAddr is the validation function for validating if the field's value is a resolvable ip address.
func StringIsIPv4 ¶
StringIsIPv4 is the validation function for validating if a value is a valid v4 IP address.
func StringIsIPv6 ¶
StringIsIPv6 is the validation function for validating if the field's value is a valid v6 IP address.
func StringIsJSON ¶
func StringIsJWT ¶
func StringIsLowercase ¶
func StringIsMAC ¶
StringIsMAC is the validation function for validating if the field's value is a valid MAC address.
func StringIsNumber ¶
func StringIsPrintAscii ¶
func StringIsTCP4Addr ¶
StringIsTCP4Addr is the validation function for validating if the field's value is a resolvable tcp4 address.
func StringIsTCP6Addr ¶
StringIsTCP6Addr is the validation function for validating if the field's value is a resolvable tcp6 address.
func StringIsTCPAddr ¶
StringIsTCPAddr is the validation function for validating if the field's value is a resolvable tcp address.
func StringIsTimezone ¶
func StringIsUDP4Addr ¶
StringIsUDP4Addr is the validation function for validating if the field's value is a resolvable udp4 address.
func StringIsUDP6Addr ¶
StringIsUDP6Addr is the validation function for validating if the field's value is a resolvable udp6 address.
func StringIsUDPAddr ¶
StringIsUDPAddr is the validation function for validating if the field's value is a resolvable udp address.
func StringIsURI ¶
StringIsURI is the validation function for validating if the current field's value is a valid URI.
func StringIsURL ¶
StringIsURL is the validation function for validating if the current field's value is a valid URL.
func StringIsURLEncoded ¶
func StringIsUUID ¶
func StringIsUUID1 ¶
func StringIsUUID3 ¶
func StringIsUUID4 ¶
func StringIsUUID5 ¶
func StringIsUnixAddr ¶
StringIsUnixAddr is the validation function for validating if the field's value is a resolvable unix address.
func StringIsUnixCron ¶
func StringIsUppercase ¶
func StringPointerToString ¶
func Uint32PointerToString ¶
func Uint32ToString ¶
func Uint64PointerToString ¶
func Uint64ToString ¶
Types ¶
type ValidateError ¶
type ValidateError struct {
// contains filtered or unexported fields
}
func (*ValidateError) Error ¶
func (e *ValidateError) Error() string