type myType struct {
value int `json:"value"`
Name string `json:"name" validate:"required"`
URL string `json:"URL" validate:"required"`
args []otherType `json:"args" validate:"dive", "required"`
}
type otherType struct {
name string `validate:"required"`
origin string `validate:"required"`
}
err := paramsValidator.Validate(someInstantiationOfThisStruct)
嗨,你好!我在使用验证器的潜水功能时有点难过。验证程序的文档中没有这种特定的验证方案组合,我无法通过一点点调整来使其工作。
我想简单地在主结构中输入 args 数组,并验证两组 otherType 中的每一组。然而,我不太明白这应该如何发生。
我错误地理解潜水,它当然不起作用,因为验证者无法使用Verify()确定不正确的验证。
我做错了什么特别的事情吗?一般来说,我应该如何计算和验证数组中的参数?
郎朗坤
绝地无双
哈士奇WWW
随时随地看视频慕课网APP
相关分类