Documentation ¶
Index ¶
- type Language
- type ValidatorMessageTranslator
- func (t *ValidatorMessageTranslator) AddCustomMustParseMessageFileBytes(fileBytes []byte, filename string)
- func (t *ValidatorMessageTranslator) AddCustomMustParseMessageFileBytesFromURL(url string, filename string)
- func (t *ValidatorMessageTranslator) ValidateSchema(lang string, data interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ValidatorMessageTranslator ¶ added in v0.0.5
func NewValidatorMessageTranslator ¶ added in v0.0.5
func NewValidatorMessageTranslator() *ValidatorMessageTranslator
func (*ValidatorMessageTranslator) AddCustomMustParseMessageFileBytes ¶ added in v0.0.6
func (t *ValidatorMessageTranslator) AddCustomMustParseMessageFileBytes(fileBytes []byte, filename string)
AddCustomMustParseMessageFileBytes is a function that allows you to add custom messages to the validator. The fileBytes parameter is the content of the file to be added. The filename parameter is the name of the file to be added. It must be in the format: active.{language}.toml (e.g. active.fr.toml)
The format of the file must be as follows: [is-hola] # tag one = "The field %s must be hola" # message other = "The field %s must be hola" # message
[is-required] one = "The field %s is required" other = "The field %s is required"
func (*ValidatorMessageTranslator) AddCustomMustParseMessageFileBytesFromURL ¶ added in v0.0.6
func (t *ValidatorMessageTranslator) AddCustomMustParseMessageFileBytesFromURL(url string, filename string)
AddCustomMustParseMessageFileBytesFromURL is a function that allows you to add custom messages to the validator. The url parameter is the url of the file to be added.
The format of the file must be as follows: [is-hola] # tag one = "The field %s must be hola" # message other = "The field %s must be hola" # message
[is-required] one = "The field %s is required" other = "The field %s is required"
func (*ValidatorMessageTranslator) ValidateSchema ¶ added in v0.0.5
func (t *ValidatorMessageTranslator) ValidateSchema(lang string, data interface{}) error