Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorBag ¶
ErrorBag is a custom type that holds a map of field selectors and their related validation errors.
func (ErrorBag) FirstOf ¶
FirstOf returns the first error message of the given selector (if it exists).
type InputBag ¶
InputBag is a custom type representing the validation input.
func NewInputBagFromStruct ¶
NewInputBagFromStruct converts the given input struct into InputBag. Note that since we use json.Marshal and json.Unmarshal for this conversion, the given struct must have exported field, and if the exported fields have json tag, keep in mind that the InputBag keys are the same as the tags.
func (InputBag) Get ¶
Get retrieves the value associated with the provided selector, which may reference nested values using dot notation. For example, "user.settings.avatar" or "users.0.email". It returns the value found at the specified path and a boolean indicating whether the value exists. The returned value will be nil and false if the path does not exist in the InputBag.