Documentation ¶
Index ¶
- Variables
- func ShipLength(shipName string) int
- type Form
- func (f *Form) FieldsMatch(f1, f2 string, shouldTheyMatch bool)
- 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) PasswordComplexity()
- func (f *Form) PermittedValues(field string, opts ...string)
- func (f *Form) Required(fields ...string)
- func (f *Form) RequiredNumberOfItems(shipType string, requiredNumber int, countedNumber int)
- func (f *Form) SpacesAbsent(field string)
- func (f *Form) Valid() bool
- func (f *Form) ValidNumberOfItems(coordinates []string, shipName string)
Constants ¶
This section is empty.
Variables ¶
var EmailRX = 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 ¶
func ShipLength ¶
ShipLength - how many pins should this ship get?
Types ¶
type Form ¶
Create a custom Form struct, which anonymously embeds a url.Values object (to hold the form data) and an Errors field to hold any validation errors
func New ¶
Define a New function to initialize a custom Form struct
Takes the Form data as the parameter
func (*Form) FieldsMatch ¶
FieldsMatch - check to ensure fields match; ex: passwords
func (*Form) MatchesPattern ¶
Matches Pattern - for verifying a pattern match
func (*Form) PasswordComplexity ¶
func (f *Form) PasswordComplexity()
PasswordComplexity - make sure password meets basic complexity requirements
func (*Form) PermittedValues ¶
PermittedValues - matches one of a set of specific permitted values
func (*Form) RequiredNumberOfItems ¶
RequiredNumberOfItems - require X number of coordinates for the specific ship
func (*Form) SpacesAbsent ¶
MaxLength - for checking maximum number of characters
func (*Form) ValidNumberOfItems ¶
ValidNumberOfItems - make sure that the ship in question has proper pin placement