valid

package
v1.20.18 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRule added in v1.20.7

func AddRule(key string, f func(rule string, data interface{}) error)

add rule

Types

type Rule added in v1.20.7

type Rule struct {
	// key
	Key string
	// 翻译后的字段名
	// default Key
	Trans string
	// valid
	Valid string
}

func (*Rule) Check added in v1.20.7

func (n *Rule) Check(data interface{}) (err error)

rule common rule Check

type ValidError

type ValidError map[string]error

valid type

func Valid

func Valid(data interface{}) ValidError

Valid

func ValidModel

func ValidModel(data interface{}, model interface{}) ValidError

form/single json data

type ValidRule

type ValidRule map[string]*vRule

valid type

func (*ValidRule) String

func (v *ValidRule) String() string

func (*ValidRule) Struct

func (v *ValidRule) Struct(str string)

type Validator

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

func (*Validator) Check

func (v *Validator) Check() (errs ValidError)

Check

Jump to

Keyboard shortcuts

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