rule

package
v3.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRules added in v3.2.6

func RegisterRules(v *validator.Validator, db *gorm.DB)

RegisterRules 注册面板自定义规则到验证器实例

Types

type Cron

type Cron struct {
	// contains filtered or unexported fields
}

Cron 校验规则

func NewCron

func NewCron() *Cron

func (*Cron) Message added in v3.2.6

func (s *Cron) Message() string

func (*Cron) Passes

func (s *Cron) Passes(f validator.Field) bool

func (*Cron) Signature added in v3.2.6

func (s *Cron) Signature() string

type Exists

type Exists struct {
	// contains filtered or unexported fields
}

Exists 验证一个值在某个表中的字段中存在,支持同时判断多个字段 用法:exists:表名称,字段名称,字段名称 例子:exists:users,phone,email

func NewExists

func NewExists(db *gorm.DB) *Exists

func (*Exists) Message added in v3.2.6

func (r *Exists) Message() string

func (*Exists) Passes

func (r *Exists) Passes(f validator.Field) bool

func (*Exists) Signature added in v3.2.6

func (r *Exists) Signature() string

type IPCIDR

type IPCIDR struct{}

IPCIDR 验证一个值是否是有效的 IP 或 CIDR

func NewIPCIDR

func NewIPCIDR() *IPCIDR

func (*IPCIDR) Message added in v3.2.6

func (r *IPCIDR) Message() string

func (*IPCIDR) Passes

func (r *IPCIDR) Passes(f validator.Field) bool

func (*IPCIDR) Signature added in v3.2.6

func (r *IPCIDR) Signature() string

type NotExists

type NotExists struct {
	// contains filtered or unexported fields
}

NotExists 验证一个值在某个表中的字段中不存在,支持同时判断多个字段 用法:not_exists:表名称,字段名称,字段名称 例子:not_exists:users,phone,email

func NewNotExists

func NewNotExists(db *gorm.DB) *NotExists

func (*NotExists) Message added in v3.2.6

func (r *NotExists) Message() string

func (*NotExists) Passes

func (r *NotExists) Passes(f validator.Field) bool

func (*NotExists) Signature added in v3.2.6

func (r *NotExists) Signature() string

type Password

type Password struct{}

Password 密码复杂度校验

func NewPassword

func NewPassword() *Password

func (*Password) Message added in v3.2.6

func (r *Password) Message() string

func (*Password) Passes

func (r *Password) Passes(f validator.Field) bool

func (*Password) Signature added in v3.2.6

func (r *Password) Signature() string

type UnixPath added in v3.2.6

type UnixPath struct {
	// contains filtered or unexported fields
}

UnixPath 校验 Unix 绝对路径

func NewUnixPath added in v3.2.6

func NewUnixPath() *UnixPath

func (*UnixPath) Message added in v3.2.6

func (r *UnixPath) Message() string

func (*UnixPath) Passes added in v3.2.6

func (r *UnixPath) Passes(f validator.Field) bool

func (*UnixPath) Signature added in v3.2.6

func (r *UnixPath) Signature() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL