Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddRule ¶
AddRule register a validation rule. The rule will be usable in request validation by using the given rule name.
Type-dependent messages let you define a different message for numeric, string, arrays and files. The language entry used will be "validation.rules.rulename.type"
func RequireParametersCount ¶
RequireParametersCount checks if the given parameters slice has at least "count" elements. If this is not the case, panics.
Use this to make sure your validation rules are correctly used.
func SetPlaceholder ¶
func SetPlaceholder(placeholderName string, replacer Placeholder)
SetPlaceholder sets the replacer function for the given placeholder. If a placeholder with this name already exists, the latter will be overridden.
validation.SetPlaceholder("min", func(field string, rule string, parameters []string, language string) string { return parameters[0] // Replace ":min" by the first parameter in the rule definition })
Types ¶
type Placeholder ¶
Placeholder function defining a placeholder in a validation message. This function should return the value to replace the placeholder with.