本文整理汇总了Golang中github.com/robfig/revel.Validation.MaxSize方法的典型用法代码示例。如果您正苦于以下问题:Golang Validation.MaxSize方法的具体用法?Golang Validation.MaxSize怎么用?Golang Validation.MaxSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/robfig/revel.Validation
的用法示例。
在下文中一共展示了Validation.MaxSize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Validate
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},
)
}
示例2: Validate
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("请输入排序!")
}
示例3: Validate
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)
}
示例4: Validate
func (post *Post) Validate(v *revel.Validation) {
v.MaxSize(post.Body, 100)
}
示例5: Validate
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("帖子内容不能为空")
}