func (hotel *Hotel) Validate(v *revel.Validation) { v.Check(hotel.Name, revel.Required{}, revel.MaxSize{50}, ) v.MaxSize(hotel.Address, 100) v.Check(hotel.City, revel.Required{}, revel.MaxSize{40}, ) v.Check(hotel.State, revel.Required{}, revel.MaxSize{6}, revel.MinSize{2}, ) v.Check(hotel.Zip, revel.Required{}, revel.MaxSize{6}, revel.MinSize{5}, ) v.Check(hotel.Country, revel.Required{}, revel.MaxSize{40}, revel.MinSize{2}, ) }
func (menu *Menu) Validate(v *revel.Validation) { v.Required(menu.Name).Message("请输入菜单名称!") v.MaxSize(menu.Name, 105).Message("最多35个字") v.Required(menu.Pid).Message("请选择父菜单!") v.Required(menu.Url).Message("请输入菜单地址!") v.Required(menu.Order).Message("请输入排序!") }
func (c *Credentials) Validate(v *revel.Validation) { v.Required(c.Email) v.Email(c.Email) v.MaxSize(c.Email, 32) v.MinSize(c.Email, 5) v.Required(c.Password) v.MaxSize(c.Password, 128) v.MinSize(c.Password, 6) }
func (post *Post) Validate(v *revel.Validation) { v.MaxSize(post.Body, 100) }
func (topic *Topic) Validate(v *revel.Validation) { v.Required(topic.Title).Message("请输入标题") v.MaxSize(topic.Title, 105).Message("最多35个字") v.Required(topic.Category).Message("请选择分类") v.Required(topic.Content).Message("帖子内容不能为空") }