文件名称:gody:Go的轻量级结构验证器
文件大小:19KB
文件格式:ZIP
更新时间:2024-06-13 02:42:19
go golang validator struct struct-tags
高迪 安装 go get github.com/guiferpa/gody/v2 用法 package main import ( "encoding/json" "fmt" "net/http" gody "github.com/guiferpa/gody/v2" "github.com/guiferpa/gody/v2/rule" ) type RequestBody struct { Name string `json:"name" validate:"not_empty"` Age int `json:"age" validate:"min=21"` } func HTTPHandler ( v * gody. Validator ) http. HandlerFunc { return http . Han
【文件预览】:
gody-master
----.gitignore(197B)
----go.mod(44B)
----validate_test.go(2KB)
----tag.go(48B)
----rule()
--------ruletest()
--------required_test.go(917B)
--------max.go(673B)
--------enum_test.go(960B)
--------enum.go(624B)
--------max_test.go(2KB)
--------min_bound.go(674B)
--------not_empty.go(503B)
--------max_bound.go(677B)
--------min_test.go(2KB)
--------min.go(671B)
--------max_bound_test.go(1KB)
--------rule.go(399B)
--------not_empty_test.go(1KB)
--------min_bound_test.go(1KB)
--------required.go(695B)
----serialize_test.go(5KB)
----serialize.go(4KB)
----LICENSE(1KB)
----.github()
--------workflows()
----examples()
--------http_api.go(2KB)
--------simple.go(1KB)
--------custom_rule.go(1KB)
----validator.go(987B)
----README.md(3KB)
----.drone.yml(342B)
----validator_test.go(1KB)
----rule.go(169B)
----validate.go(1KB)