Documentation
¶
Overview ¶
Package forms defines how to create a form and adds validations.
Index ¶
- Variables
- type Form
- func (f *Form) IsEqualString(field1 string, field2 string)
- func (f *Form) MatchesPattern(field string, pattern *regexp.Regexp)
- func (f *Form) MaxLength(field string, d int)
- func (f *Form) MinLength(field string, d int)
- func (f *Form) PermittedValues(field string, opts ...string)
- func (f *Form) Required(fields ...string)
- func (f *Form) SecurePassword(field string)
- func (f *Form) Valid() bool
- func (f *Form) ValidUrl(field string)
Constants ¶
This section is empty.
Variables ¶
View Source
var EmailRegex = regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$")
Functions ¶
This section is empty.
Types ¶
type Form ¶
Form creates a custom form struct, embeds a url.Values object
func (*Form) IsEqualString ¶
IsEqual checks if two string input fields are equal.
func (*Form) MatchesPattern ¶
Implement a MatchesPattern method to check that a specific field in the form matches a regular expression. If the check fails then add the appropriate message to the form errors.
func (*Form) PermittedValues ¶
PermittedValues disallows unknown fields.
func (*Form) SecurePassword ¶
http://www.inanzzz.com/index.php/post/8l1a/validating-user-password-in-golang-requests SecurePassword defines a set of requirements for a password.
Click to show internal directories.
Click to hide internal directories.