Golang数据校验validator

文章目录

    • dive

参考:https://github.com/go-playground/validator
https://godoc.org/gopkg.in/go-playground/validator.v9

dive

dive用于深入到切片、数组和map中进行数据校验
Example#1

[][]string with validation tag "gt=0,dive,len=1,dive,required"
// gt=0 will be applied to []
// len=1 will be applied to []string
// required will be applied to string

Example#2

[][]string with validation tag "gt=0,dive,dive,required"
// gt=0 will be applied to []
// []string will be spared validation
// required will be applied to string

你可能感兴趣的:(go,Golang,form,validator,校验,dive)