mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
21 lines
335 B
Go
21 lines
335 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"github.com/gogf/gf/frame/g"
|
|
"github.com/gogf/gf/util/gvalid"
|
|
)
|
|
|
|
// same校验
|
|
func main() {
|
|
type User struct {
|
|
Pass string `gvalid:"passwd1 @required|length:2,20|password3||密码强度不足"`
|
|
}
|
|
|
|
user := &User{
|
|
Pass: "1",
|
|
}
|
|
|
|
g.Dump(gvalid.CheckStruct(context.TODO(), user, nil).Maps())
|
|
}
|