Documentation ¶
Index ¶
- func All(validators ...schema.SchemaValidateFunc) schema.SchemaValidateFunc
- func AllDiag(validators ...schema.SchemaValidateDiagFunc) schema.SchemaValidateDiagFunc
- func Any(validators ...schema.SchemaValidateFunc) schema.SchemaValidateFunc
- func AnyDiag(validators ...schema.SchemaValidateDiagFunc) schema.SchemaValidateDiagFunc
- func FloatAtLeast(min float64) schema.SchemaValidateFunc
- func FloatAtMost(max float64) schema.SchemaValidateFunc
- func FloatBetween(min, max float64) schema.SchemaValidateFunc
- func IntAtLeast(min int) schema.SchemaValidateFunc
- func IntAtMost(max int) schema.SchemaValidateFunc
- func IntBetween(min, max int) schema.SchemaValidateFunc
- func IntDivisibleBy(divisor int) schema.SchemaValidateFunc
- func IntInSlice(valid []int) schema.SchemaValidateFunc
- func IntNotInSlice(valid []int) schema.SchemaValidateFunc
- func IsCIDR(i interface{}, k string) (warnings []string, errors []error)
- func IsCIDRNetwork(min, max int) schema.SchemaValidateFunc
- func IsDayOfTheWeek(ignoreCase bool) schema.SchemaValidateFunc
- func IsIPAddress(i interface{}, k string) (warnings []string, errors []error)
- func IsIPv4Address(i interface{}, k string) (warnings []string, errors []error)
- func IsIPv4Range(i interface{}, k string) (warnings []string, errors []error)
- func IsIPv6Address(i interface{}, k string) (warnings []string, errors []error)
- func IsMACAddress(i interface{}, k string) (warnings []string, errors []error)
- func IsMonth(ignoreCase bool) schema.SchemaValidateFunc
- func IsPortNumber(i interface{}, k string) (warnings []string, errors []error)
- func IsPortNumberOrZero(i interface{}, k string) (warnings []string, errors []error)
- func IsRFC3339Time(i interface{}, k string) (warnings []string, errors []error)
- func IsURLWithHTTPS(i interface{}, k string) (_ []string, errors []error)
- func IsURLWithHTTPorHTTPS(i interface{}, k string) (_ []string, errors []error)
- func IsURLWithScheme(validSchemes []string) schema.SchemaValidateFunc
- func IsUUID(i interface{}, k string) (warnings []string, errors []error)
- func ListOfUniqueStrings(i interface{}, k string) (warnings []string, errors []error)
- func MapKeyLenBetween(min, max int) schema.SchemaValidateDiagFunc
- func MapKeyMatch(r *regexp.Regexp, message string) schema.SchemaValidateDiagFunc
- func MapValueLenBetween(min, max int) schema.SchemaValidateDiagFunc
- func MapValueMatch(r *regexp.Regexp, message string) schema.SchemaValidateDiagFunc
- func NoZeroValues(i interface{}, k string) (s []string, es []error)
- func StringDoesNotContainAny(chars string) schema.SchemaValidateFunc
- func StringDoesNotMatch(r *regexp.Regexp, message string) schema.SchemaValidateFunc
- func StringInSlice(valid []string, ignoreCase bool) schema.SchemaValidateFunc
- func StringIsBase64(i interface{}, k string) (warnings []string, errors []error)
- func StringIsEmpty(i interface{}, k string) ([]string, []error)
- func StringIsJSON(i interface{}, k string) (warnings []string, errors []error)
- func StringIsNotEmpty(i interface{}, k string) ([]string, []error)
- func StringIsNotWhiteSpace(i interface{}, k string) ([]string, []error)
- func StringIsValidRegExp(i interface{}, k string) (warnings []string, errors []error)
- func StringIsWhiteSpace(i interface{}, k string) ([]string, []error)
- func StringLenBetween(min, max int) schema.SchemaValidateFunc
- func StringMatch(r *regexp.Regexp, message string) schema.SchemaValidateFunc
- func StringNotInSlice(invalid []string, ignoreCase bool) schema.SchemaValidateFunc
- func ToDiagFunc(validator schema.SchemaValidateFunc) schema.SchemaValidateDiagFunc
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
func AllDiag ¶ added in v2.29.0
func AllDiag(validators ...schema.SchemaValidateDiagFunc) schema.SchemaValidateDiagFunc
AllDiag returns a SchemaValidateDiagFunc which tests if the provided value passes all provided SchemaValidateDiagFunc
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 AnyDiag ¶ added in v2.29.0
func AnyDiag(validators ...schema.SchemaValidateDiagFunc) schema.SchemaValidateDiagFunc
AnyDiag returns a SchemaValidateDiagFunc which tests if the provided value passes any of the provided SchemaValidateDiagFunc
func FloatAtLeast ¶
func FloatAtLeast(min float64) schema.SchemaValidateFunc
FloatAtLeast returns a SchemaValidateFunc which tests if the provided value is of type float and is at least min (inclusive)
func FloatAtMost ¶
func FloatAtMost(max float64) schema.SchemaValidateFunc
FloatAtMost returns a SchemaValidateFunc which tests if the provided value is of type float and is at most max (inclusive)
func FloatBetween ¶
func FloatBetween(min, max float64) schema.SchemaValidateFunc
FloatBetween returns a SchemaValidateFunc which tests if the provided value is of type float64 and is between min and max (inclusive).
func IntAtLeast ¶
func IntAtLeast(min int) schema.SchemaValidateFunc
IntAtLeast returns a SchemaValidateFunc which tests if the provided value is of type int and is at least min (inclusive)
func IntAtMost ¶
func IntAtMost(max int) schema.SchemaValidateFunc
IntAtMost returns a SchemaValidateFunc which tests if the provided value is of type int and is at most max (inclusive)
func IntBetween ¶
func IntBetween(min, max int) schema.SchemaValidateFunc
IntBetween returns a SchemaValidateFunc which tests if the provided value is of type int and is between min and max (inclusive)
func IntDivisibleBy ¶
func IntDivisibleBy(divisor int) schema.SchemaValidateFunc
IntDivisibleBy returns a SchemaValidateFunc which tests if the provided value is of type int and is divisible by a given number
func IntInSlice ¶
func IntInSlice(valid []int) schema.SchemaValidateFunc
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 ¶
func IntNotInSlice(valid []int) schema.SchemaValidateFunc
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 IsCIDRNetwork ¶
func IsCIDRNetwork(min, max int) schema.SchemaValidateFunc
IsCIDRNetwork returns a SchemaValidateFunc which tests if the provided value is of type string, is in valid Value network notation, and has significant bits between min and max (inclusive)
func IsDayOfTheWeek ¶
func IsDayOfTheWeek(ignoreCase bool) schema.SchemaValidateFunc
IsDayOfTheWeek is 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 IsMACAddress ¶
IsMACAddress is a SchemaValidateFunc which tests if the provided value is of type string and a valid MAC address
func IsMonth ¶
func IsMonth(ignoreCase bool) schema.SchemaValidateFunc
IsMonth is 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 IsPortNumberOrZero ¶
IsPortNumberOrZero is a SchemaValidateFunc which tests if the provided value is of type string and a valid TCP Port Number or zero
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 ¶
func IsURLWithScheme(validSchemes []string) schema.SchemaValidateFunc
IsURLWithScheme is a SchemaValidateFunc which tests if the provided value is of type string and a valid URL with the provided schemas
func ListOfUniqueStrings ¶
ListOfUniqueStrings is a ValidateFunc that ensures a list has no duplicate items in it. It's useful for when a list is needed over a set because order matters, yet the items still need to be unique.
func MapKeyLenBetween ¶
func MapKeyLenBetween(min, max int) schema.SchemaValidateDiagFunc
MapKeyLenBetween returns a SchemaValidateDiagFunc which tests if the provided value is of type map and the length of all keys are between min and max (inclusive)
func MapKeyMatch ¶
func MapKeyMatch(r *regexp.Regexp, message string) schema.SchemaValidateDiagFunc
MapKeyMatch returns a SchemaValidateDiagFunc which tests if the provided value is of type map and all keys match a given regexp. Optionally an error message can be provided to return something friendlier than "expected to match some globby regexp".
func MapValueLenBetween ¶
func MapValueLenBetween(min, max int) schema.SchemaValidateDiagFunc
MapValueLenBetween returns a SchemaValidateDiagFunc which tests if the provided value is of type map and the length of all values are between min and max (inclusive)
func MapValueMatch ¶
func MapValueMatch(r *regexp.Regexp, message string) schema.SchemaValidateDiagFunc
MapValueMatch returns a SchemaValidateDiagFunc which tests if the provided value is of type map and all values match a given regexp. Optionally an error message can be provided to return something friendlier than "expected to match some globby regexp".
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 StringDoesNotContainAny ¶
func StringDoesNotContainAny(chars string) schema.SchemaValidateFunc
StringDoesNotContainAny returns a SchemaValidateFunc which validates that the provided value does not contain any of the specified Unicode code points in chars.
func StringDoesNotMatch ¶
func StringDoesNotMatch(r *regexp.Regexp, message string) schema.SchemaValidateFunc
StringDoesNotMatch returns a SchemaValidateFunc which tests if the provided value does not match a given regexp. Optionally an error message can be provided to return something friendlier than "must not match some globby regexp".
func StringInSlice ¶
func StringInSlice(valid []string, ignoreCase bool) schema.SchemaValidateFunc
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 StringIsWhiteSpace ¶
StringIsWhiteSpace is a ValidateFunc that ensures a string is composed of entirely whitespace
func StringLenBetween ¶
func StringLenBetween(min, max int) schema.SchemaValidateFunc
StringLenBetween returns a SchemaValidateFunc which tests if the provided value is of type string and has length between min and max (inclusive)
func StringMatch ¶
func StringMatch(r *regexp.Regexp, message string) schema.SchemaValidateFunc
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) schema.SchemaValidateFunc
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
func ToDiagFunc ¶ added in v2.4.0
func ToDiagFunc(validator schema.SchemaValidateFunc) schema.SchemaValidateDiagFunc
ToDiagFunc is a wrapper for legacy schema.SchemaValidateFunc converting it to schema.SchemaValidateDiagFunc
Types ¶
This section is empty.