Exemple #1
0
func (i *Item) Validate(v *revel.Validation) {
	v.Check(i.Name,
		revel.ValidRequired(),
		revel.ValidMaxSize(25))
	v.Check(i.Stock,
		revel.ValidRequired())
	v.Check(i.Cost,
		revel.ValidRequired())
}
Exemple #2
0
func (b *BidItem) Validate(v *revel.Validation) {

	v.Check(b.Name,
		revel.ValidRequired(),
		revel.ValidMaxSize(25))

	v.Check(b.Category,
		revel.ValidRequired(),
		revel.ValidMatch(
			regexp.MustCompile(
				"^(travel|leasure|sports|entertainment)$")))

	v.Check(b.EstimatedValue,
		revel.ValidRequired())

	v.Check(b.StartBid,
		revel.ValidRequired())

	v.Check(b.BidIncrement,
		revel.ValidRequired())
}
func (o *Object) Validate(v *revel.Validation) {
	// all OIDs are 65 characters long
	v.Check(o.Oid,
		revel.ValidRequired(),
		revel.ValidMaxSize(65))
}
Exemple #4
0
func (m *User) Validate(v *revel.Validation) {
	v.Check(m.Username, revel.ValidRequired(), revel.ValidMaxSize(25))
	v.Check(m.Password, revel.ValidRequired(), revel.ValidMinSize(6))
}