Documentation ¶
Index ¶
- func All(validators ...schema.SchemaValidateFunc) schema.SchemaValidateFunc
- func Any(validators ...schema.SchemaValidateFunc) schema.SchemaValidateFunc
- func FloatAtLeast(min float64) func(interface{}, string) ([]string, []error)
- func FloatBetween(min, max float64) func(interface{}, string) ([]string, []error)
- func IntAtLeast(min int) func(interface{}, string) ([]string, []error)
- func IntAtMost(max int) func(interface{}, string) ([]string, []error)
- func IntBetween(min, max int) func(interface{}, string) ([]string, []error)
- func IntDivisibleBy(divisor int) func(interface{}, string) ([]string, []error)
- func IntInSlice(valid []int) func(interface{}, string) ([]string, []error)
- func IntNotInSlice(valid []int) func(interface{}, string) ([]string, []error)
- func IsCIDR(i interface{}, k string) ([]string, []error)
- func IsDayOfTheWeek(ignoreCase bool) func(interface{}, string) ([]string, []error)
- func IsIPAddress(i interface{}, k string) ([]string, []error)
- func IsIPv4Address(i interface{}, k string) ([]string, []error)
- func IsIPv4Range(i interface{}, k string) ([]string, []error)
- func IsIPv6Address(i interface{}, k string) ([]string, []error)
- func IsMonth(ignoreCase bool) func(interface{}, string) ([]string, []error)
- func IsPortNumber(i interface{}, k string) ([]string, []error)
- func IsRFC3339Time(i interface{}, k string) ([]string, []error)
- func IsURLWithHTTPS(i interface{}, k string) ([]string, []error)
- func IsURLWithHTTPorHTTPS(i interface{}, k string) ([]string, []error)
- func IsURLWithScheme(validSchemes []string) func(interface{}, string) ([]string, []error)
- func IsUUID(i interface{}, k string) ([]string, []error)
- func NoZeroValues(i interface{}, k string) ([]string, []error)
- func None(validators map[string]func(interface{}, string) ([]string, []error)) func(interface{}, string) ([]string, []error)
- func StringDoesNotContainAny(chars string) func(interface{}, string) ([]string, []error)
- func StringInSlice(valid []string, ignoreCase bool) func(interface{}, string) ([]string, []error)
- func StringIsBase64(i interface{}, k string) ([]string, []error)
- func StringIsEmpty(i interface{}, k string) ([]string, []error)
- func StringIsJSON(i interface{}, k string) ([]string, []error)
- func StringIsNotEmpty(i interface{}, k string) ([]string, []error)
- func StringIsNotWhiteSpace(i interface{}, k string) ([]string, []error)
- func StringIsValidRegExp(i interface{}, k string) ([]string, []error)
- func StringLenBetween(min, max int) func(interface{}, string) ([]string, []error)
- func StringMatch(r *regexp.Regexp, message string) func(interface{}, string) ([]string, []error)
- func StringNotInSlice(invalid []string, ignoreCase bool) func(interface{}, string) ([]string, []error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶
func All(validators ...schema.SchemaValidateFunc) schema.SchemaValidateFunc
All returns a SchemaValidateFunc which tests if the provided value passes all provided SchemaValidateFunc lint:ignore SA1019 SDKv2 migration - staticcheck's own linter directives are currently being ignored under golanci-lint
func Any ¶
func Any(validators ...schema.SchemaValidateFunc) schema.SchemaValidateFunc
Any returns a SchemaValidateFunc which tests if the provided value passes any of the provided SchemaValidateFunc
func FloatAtLeast ¶
FloatAtLeast returns a SchemaValidateFunc which tests if the provided value is of type float and is at least min (inclusive)
func FloatBetween ¶
FloatBetween returns a SchemaValidateFunc which tests if the provided value is of type float64 and is between min and max (inclusive).
func IntAtLeast ¶
IntAtLeast returns a SchemaValidateFunc which tests if the provided value is of type int and is at least min (inclusive)
func IntAtMost ¶
IntAtMost returns a SchemaValidateFunc which tests if the provided value is of type int and is at most max (inclusive)
func IntBetween ¶
IntBetween returns a SchemaValidateFunc which tests if the provided value is of type int and is between min and max (inclusive)
func IntDivisibleBy ¶
IntDivisibleBy returns a SchemaValidateFunc which tests if the provided value is of type int and is divisible by a given number
func IntInSlice ¶
IntInSlice returns a SchemaValidateFunc which tests if the provided value is of type int and matches the value of an element in the valid slice
func IntNotInSlice ¶
IntNotInSlice returns a SchemaValidateFunc which tests if the provided value is of type int and matches the value of an element in the valid slice
func IsCIDR ¶
IsCIDR is a SchemaValidateFunc which tests if the provided value is of type string and a valid CIDR
func IsDayOfTheWeek ¶
IsDayOfTheWeek id a SchemaValidateFunc which tests if the provided value is of type string and a valid english day of the week
func IsIPAddress ¶
IsIPAddress is a SchemaValidateFunc which tests if the provided value is of type string and is a single IP (v4 or v6)
func IsIPv4Address ¶
IsIPv4Address is a SchemaValidateFunc which tests if the provided value is of type string and a valid IPv4 address
func IsIPv4Range ¶
IsIPv4Range is a SchemaValidateFunc which tests if the provided value is of type string, and in valid IP range
func IsIPv6Address ¶
IsIPv6Address is a SchemaValidateFunc which tests if the provided value is of type string and a valid IPv6 address
func IsMonth ¶
IsMonth id a SchemaValidateFunc which tests if the provided value is of type string and a valid english month
func IsPortNumber ¶
IsPortNumber is a SchemaValidateFunc which tests if the provided value is of type string and a valid TCP Port Number
func IsRFC3339Time ¶
IsRFC3339Time is a SchemaValidateFunc which tests if the provided value is of type string and a valid RFC33349Time
func IsURLWithHTTPS ¶
IsURLWithHTTPS is a SchemaValidateFunc which tests if the provided value is of type string and a valid HTTPS URL
func IsURLWithHTTPorHTTPS ¶
IsURLWithHTTPorHTTPS is a SchemaValidateFunc which tests if the provided value is of type string and a valid HTTP or HTTPS URL
func IsURLWithScheme ¶
IsURLWithScheme is a SchemaValidateFunc which tests if the provided value is of type string and a valid URL with the provided schemas
func NoZeroValues ¶
NoZeroValues is a SchemaValidateFunc which tests if the provided value is not a zero value. It's useful in situations where you want to catch explicit zero values on things like required fields during validation.
func None ¶
func None(validators map[string]func(interface{}, string) ([]string, []error)) func(interface{}, string) ([]string, []error)
None returns a SchemaValidateFunc which tests if the provided value returns errors for all of the provided SchemaValidateFunc
func StringDoesNotContainAny ¶
StringDoesNotContainAny returns a SchemaValidateFunc which validates that the provided value does not contain any of the specified Unicode code points in chars.
func StringInSlice ¶
StringInSlice returns a SchemaValidateFunc which tests if the provided value is of type string and matches the value of an element in the valid slice will test with in lower case if ignoreCase is true
func StringIsBase64 ¶
StringIsBase64 is a ValidateFunc that ensures a string can be parsed as Base64
func StringIsEmpty ¶
StringIsEmpty is a ValidateFunc that ensures a string has no characters
func StringIsJSON ¶
StringIsJSON is a SchemaValidateFunc which tests to make sure the supplied string is valid JSON.
func StringIsNotEmpty ¶
StringIsNotEmpty is a ValidateFunc that ensures a string is not empty
func StringIsNotWhiteSpace ¶
StringIsNotWhiteSpace is a ValidateFunc that ensures a string is not empty or consisting entirely of whitespace characters
func StringIsValidRegExp ¶
StringIsValidRegExp returns a SchemaValidateFunc which tests to make sure the supplied string is a valid regular expression.
func StringLenBetween ¶
StringLenBetween returns a SchemaValidateFunc which tests if the provided value is of type string and has length between min and max (inclusive)
func StringMatch ¶
StringMatch returns a SchemaValidateFunc which tests if the provided value matches a given regexp. Optionally an error message can be provided to return something friendlier than "must match some globby regexp".
func StringNotInSlice ¶
func StringNotInSlice(invalid []string, ignoreCase bool) func(interface{}, string) ([]string, []error)
StringNotInSlice returns a SchemaValidateFunc which tests if the provided value is of type string and does not match the value of any element in the invalid slice will test with in lower case if ignoreCase is true
Types ¶
This section is empty.