• 校验方法

    校验方法

    接口文档:https://godoc.org/github.com/gogf/gf/g/util/gvalid

    1. func Check(value interface{}, rules string, msgs interface{}, params ...map[string]interface{}) *Error
    2. func CheckMap(params map[string]interface{}, rules interface{}, msgs ...CustomMsg) *Error
    3. func CheckStruct(object interface{}, rules interface{}, msgs ...CustomMsg) *Error

    简要说明:

    1. Check方法用于单条数据校验,比较简单,方法详细介绍请看后续章节;
    2. CheckMap方法用于多条数据校验,校验的主体变量为map类型,方法详细介绍请看后续章节;
    3. CheckStruct方法用于多条数据校验,校验的主体变量为结构体对象类型,方法详细介绍请看后续章节;
    4. Check*方法只有在返回nil的情况下,表示数据校验成功,否则返回校验出错的错误信息对象指针*Error