validator

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegRule

func RegRule(key string, rules ...string) bool

rule format: eq:int:1,2 (eq is rule name, int is param type, 1, 2 are params)

rule names: eq,eq_feild,ge,gt,le,len,lt,minlen,maxlen,regx

func Register

func Register(r rule.RuleInterface)

func Valid

func Valid(all map[string]any) error

Types

type Validator

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

func NewValidator

func NewValidator() *Validator

func (*Validator) Add

func (v *Validator) Add(valid rule.RuleInterface)

func (*Validator) Valid

func (v *Validator) Valid(key string, value any, rules []*rule.Rule, all map[string]any) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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