本文整理匯總了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("帖子內容不能為空")
}