【文件属性】:
文件名称:validator-go:Go的输入验证
文件大小:8KB
文件格式:ZIP
更新时间:2021-04-30 18:15:40
Go
验证器
一种简单有效的方法来验证golang的strucs中的属性值。 可用于验证传入的请求数据,以确保所有用户数据都是正确的。
$ go get github.com/strom87/validator-go
开始吧
import (
"github.com/strom87/validator-go"
)
type Example struct {
ValueOne int `validator:"between:3,8"`
ValueTwo float64 `validator:"min:5|max:10"`
ValueThree string `validator:"regexp:ca[a-z]{2}e"`
ValueFour string `validator:"alpha"`
Email
【文件预览】:
validator-go-master
----validations.go(7KB)
----helpers.go(2KB)
----LICENSE(1KB)
----validaton_type.go(78B)
----languages()
--------en.json(565B)
----validator.go(1KB)
----validation_test.go(5KB)
----property.go(871B)
----README.md(3KB)
----language.go(888B)