验证器:转到结构验证器

时间:2021-02-12 01:33:40
【文件属性】:
文件名称:验证器:转到结构验证器
文件大小:23KB
文件格式:ZIP
更新时间:2021-02-12 01:33:40
Go 验证器 类型安全的Go Struct验证器 import vd "github.com/goclub/validator" 例如,去主流的结构体校验器使用结构体标签配置规则,这种方式类型不安全,一旦结构体标签写错将无法通过编译期检查出来。 type exampleStruct2 struct { Name string `valid:"-"` Email string `valid:"email"` // 一旦单词写错只有运行期才能发现错误,且不容易记住各种语法 } goclub/validator提供类型安全高级的验证器。 结构体CreateUser type CreateUser struct { Email string NikeName string Age int } 实现CreateUser.VD(r *vd.Rule)方法 func ( v Reque
【文件预览】:
validator-main
----spec_string.go(5KB)
----.gitignore(13B)
----go.mod(428B)
----spec_float_test.go(5KB)
----util_test.go(600B)
----spec_string_inner_test.go(418B)
----spec_string_ext.go(8KB)
----spec_time_test.go(5KB)
----LICENSE(1KB)
----spec_float.go(2KB)
----spec_int_test.go(5KB)
----go.sum(3KB)
----spec_string_test.go(7KB)
----spec_slice.go(2KB)
----spec_bool.go(548B)
----validator.go(78B)
----chcker.go(2KB)
----example_test.go(2KB)
----util.go(868B)
----spec_slice_test.go(4KB)
----option.go(1KB)
----readme.md(2KB)
----validator_test.go(2KB)
----spec_time.go(3KB)
----format.go(4KB)
----rule.go(523B)
----spec_int.go(3KB)

网友评论