Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TEntity ¶
TEntity is a struct that contains the data and errors.
It is used by the Bind functions to return the data and errors.
func BindForm ¶
BindForm binds the request body to the given struct.
It supports application/x-www-form-urlencoded, multipart/form-data.
If the request body is empty or the decoding fails, it returns an error.
func BindJson ¶
BindJson binds the JSON request body to the given struct.
It attempts to decode the JSON body into the specified type.
If the decoding fails, it returns an error.
type Validator ¶
type Validator struct {
*validator.Validate
Translator ut.Translator
}
Validator validates struct and field values.
It uses the specified languages to find an appropriate validator and translates the error messages.
func AddValidator ¶
func AddValidator(trans ut.Translator, register func(v *validator.Validate, trans ut.Translator) (err error)) *Validator
AddValidator adds a new validator and translator to the map.
It also registers the translations for the default locale.