Documentation ¶
Index ¶
- func All(validators ...schema.SchemaValidateFunc) schema.SchemaValidateFunc
- func Any(validators ...schema.SchemaValidateFunc) schema.SchemaValidateFunc
- func CIDRNetwork(min, max int) schema.SchemaValidateFuncdeprecated
- func FloatAtLeast(min float64) schema.SchemaValidateFunc
- func FloatAtMost(max float64) schema.SchemaValidateFunc
- func FloatBetween(min, max float64) schema.SchemaValidateFunc
- func IPRange() schema.SchemaValidateFuncdeprecated
- 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 NoZeroValues(i interface{}, k string) (s []string, es []error)
- func SingleIP() schema.SchemaValidateFuncdeprecated
- 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 ValidateJsonString(i interface{}, k string) (warnings []string, errors []error)deprecated
- func ValidateListUniqueStrings(i interface{}, k string) (warnings []string, errors []error)deprecated
- func ValidateRFC3339TimeString(i interface{}, k string) (warnings []string, errors []error)deprecated
- func ValidateRegexp(i interface{}, k string) (warnings []string, errors []error)deprecated
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 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 CIDRNetwork
deprecated
func CIDRNetwork(min, max int) schema.SchemaValidateFunc
CIDRNetwork 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)
Deprecated: use IsCIDRNetwork instead
func FloatAtLeast ¶ added in v1.4.0
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 ¶ added in v1.4.0
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 IPRange
deprecated
func IPRange() schema.SchemaValidateFunc
IPRange returns a SchemaValidateFunc which tests if the provided value is of type string, and in valid IP range
Deprecated: use IsIPv4Range instead
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 ¶ added in v1.6.0
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 ¶ added in v1.6.0
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 ¶ added in v1.6.0
IsCIDR is a SchemaValidateFunc which tests if the provided value is of type string and a valid CIDR
func IsCIDRNetwork ¶ added in v1.6.0
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 ¶ added in v1.6.0
func IsDayOfTheWeek(ignoreCase bool) schema.SchemaValidateFunc
IsDayOfTheWeek id a SchemaValidateFunc which tests if the provided value is of type string and a valid english day of the week
func IsIPAddress ¶ added in v1.6.0
IsIPAddress is a SchemaValidateFunc which tests if the provided value is of type string and is a single IP (v4 or v6)
func IsIPv4Address ¶ added in v1.6.0
IsIPv4Address is a SchemaValidateFunc which tests if the provided value is of type string and a valid IPv4 address
func IsIPv4Range ¶ added in v1.6.0
IsIPv4Range is a SchemaValidateFunc which tests if the provided value is of type string, and in valid IP range
func IsIPv6Address ¶ added in v1.6.0
IsIPv6Address is a SchemaValidateFunc which tests if the provided value is of type string and a valid IPv6 address
func IsMACAddress ¶ added in v1.6.0
IsMACAddress is a SchemaValidateFunc which tests if the provided value is of type string and a valid MAC address
func IsMonth ¶ added in v1.6.0
func IsMonth(ignoreCase bool) schema.SchemaValidateFunc
IsMonth id a SchemaValidateFunc which tests if the provided value is of type string and a valid english month
func IsPortNumber ¶ added in v1.6.0
IsPortNumber is a SchemaValidateFunc which tests if the provided value is of type string and a valid TCP Port Number
func IsPortNumberOrZero ¶ added in v1.6.0
IsPortNumberOrZero is a SchemaValidateFunc which tests if the provided value is of type string and a valid TCP Port Number or zero
func IsRFC3339Time ¶ added in v1.6.0
IsRFC3339Time is a SchemaValidateFunc which tests if the provided value is of type string and a valid RFC33349Time
func IsURLWithHTTPS ¶ added in v1.6.0
IsURLWithHTTPS is a SchemaValidateFunc which tests if the provided value is of type string and a valid HTTPS URL
func IsURLWithHTTPorHTTPS ¶ added in v1.6.0
IsURLWithHTTPorHTTPS is a SchemaValidateFunc which tests if the provided value is of type string and a valid HTTP or HTTPS URL
func IsURLWithScheme ¶ added in v1.6.0
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 ¶ added in v1.6.0
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 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 SingleIP
deprecated
func SingleIP() schema.SchemaValidateFunc
SingleIP returns a SchemaValidateFunc which tests if the provided value is of type string, and in valid single Value notation
Deprecated: use IsIPAddress instead
func StringDoesNotContainAny ¶ added in v1.3.0
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 ¶ added in v1.4.0
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 ¶ added in v1.5.0
StringIsBase64 is a ValidateFunc that ensures a string can be parsed as Base64
func StringIsEmpty ¶ added in v1.5.0
StringIsEmpty is a ValidateFunc that ensures a string has no characters
func StringIsJSON ¶ added in v1.6.0
StringIsJSON is a SchemaValidateFunc which tests to make sure the supplied string is valid JSON.
func StringIsNotEmpty ¶ added in v1.5.0
StringIsNotEmpty is a ValidateFunc that ensures a string is not empty
func StringIsNotWhiteSpace ¶ added in v1.5.0
StringIsNotWhiteSpace is a ValidateFunc that ensures a string is not empty or consisting entirely of whitespace characters
func StringIsValidRegExp ¶ added in v1.6.0
StringIsValidRegExp returns a SchemaValidateFunc which tests to make sure the supplied string is a valid regular expression.
func StringIsWhiteSpace ¶ added in v1.5.0
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 ¶ added in v1.8.0
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 ValidateJsonString
deprecated
func ValidateListUniqueStrings
deprecated
ValidateListUniqueStrings 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.
Deprecated: use ListOfUniqueStrings
func ValidateRFC3339TimeString
deprecated
func ValidateRegexp
deprecated
Types ¶
This section is empty.