Documentation ¶
Overview ¶
Package gokay is used for defining validation functions that are called in generated Validate functions.
Index ¶
- func IsBCP47(s *string) error
- func IsHex(s *string) error
- func IsUUID(s *string) error
- func LengthSlice(expected int64, actual int64) error
- func LengthString(expected int64, str *string) error
- func MinLengthString(expected int64, str *string) error
- func Validate(i interface{}) error
- type ErrorMap
- type ErrorSlice
- type Validateable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LengthSlice ¶
LengthSlice not yet implemented
func LengthString ¶
LengthString checks if the value of a string pointer has a length of exactly 'expected'
func MinLengthString ¶
MinLengthString checks if the value of a string pointer has a length of at least 'expected'
Types ¶
type ErrorMap ¶
ErrorMap contains an entry for each invalid field in a struct. Values can be any struct that implements the go Error interface, including nested ErrorMaps.
type ErrorSlice ¶
type ErrorSlice []error
ErrorSlice is a slice of errors. Typically an ErrorSlice will be an entry in the ErrorMap outputted by a generated Validate function, each element of the array represents a failed validation on that field.
func (ErrorSlice) Error ¶
func (ea ErrorSlice) Error() string
Returns a JSON formatted representation of the ErrorSlice
type Validateable ¶
type Validateable interface {
Validate() error
}
Validateable specifies a generic error return type instead of an ErrorMap return type in order to allow for handwritten Validate methods to work in tandem with gokay generated Validate methods.