Documentation
¶
Index ¶
- func DefaultValidator(v reflect.Value, c path.ContextPath) report.Report
- func FieldName(s StructField, tag string) string
- func Validate(thing interface{}, tag string) report.Report
- func ValidateCustom(thing interface{}, tag string, customValidator CustomValidator) report.Report
- type CustomValidator
- type StructField
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultValidator ¶
DefaultValidator checks if the type implements the validator interface and calls the validate function if it does, returning the report.
func FieldName ¶
func FieldName(s StructField, tag string) string
func Validate ¶
Validate walks the structs, slices, and pointers in thing and calls any Validate(path.ContextPath) report.Report functions defined on the types, aggregating the results.
func ValidateCustom ¶
func ValidateCustom(thing interface{}, tag string, customValidator CustomValidator) report.Report
ValidateCustom validates thing using the custom validation function supplied. Most users will not need this and should use Validate() instead.
Types ¶
type CustomValidator ¶
type StructField ¶
type StructField struct { reflect.StructField Value reflect.Value }
StructField is an extension of go's reflect.StructField that also includes the value.
func GetFields ¶
func GetFields(v reflect.Value) []StructField
GetFields takes a value of a struct and flattens all embedded structs in it. If any fields are interfaces, it "dereferences" the interface to its underlying type.