gopkg.in/go-playground/validator中比较有用的标签

-
|
omitempty 有则验证,空值则不验证
dive
required 、 required_with[_all]、 required_without[_all]
len
max、min
eq、ne、{l|g}t[e]
oneof
alpha alphanum numberic hexadecimal
contains containsany containsrune excludes excludesall excludesrune
ip ipv4 ipv6 cidr cidrv{4|6} {t|u}cp[{4|6}]_addr 可解析的IP地址:ip[{4|6}]_addr mac
email url uri
ascii asciiprint multibyte

v9版本支持:path dir unique alphaunicode alphanumunicode startswith endswith html html_encoded url_encoded

上一篇:利用jQuery.validator来做表单验证,不要太轻松(全攻略)


下一篇:刷题5. Longest Palindromic Substring