validator

package
v0.0.0-...-7e3dfe9 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 License: Apache-2.0 Imports: 5 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CustomizeMap = make(map[string]Rules)

Functions

func Eq

func Eq(mark string) string

Eq 等于入参(==) 如果为string array Slice则为长度比较 如果是 int uint float 则为数值比较

func Ge

func Ge(mark string) string

Ge 大于等于入参(>=) 如果为string array Slice则为长度比较 如果是 int uint float 则为数值比较

func Gt

func Gt(mark string) string

Gt 大于入参(>) 如果为string array Slice则为长度比较 如果是 int uint float 则为数值比较

func Le

func Le(mark string) string

Le 小于等于入参(<=) 如果为string array Slice则为长度比较 如果是 int uint float 则为数值比较

func Lt

func Lt(mark string) string

Lt 小于入参(<) 如果为string array Slice则为长度比较 如果是 int uint float 则为数值比较

func Ne

func Ne(mark string) string

Ne 不等于入参(!=) 如果为string array Slice则为长度比较 如果是 int uint float 则为数值比较

func NotEmpty

func NotEmpty() string

NotEmpty 非空 不能为其对应类型的0值

func RegexpMatch

func RegexpMatch(rule string) string

RegexpMatch 正则校验 校验输入项是否满足正则表达式

func RegisterRule

func RegisterRule(key string, rule Rules) (err error)

RegisterRule 注册自定义规则方案建议在路由初始化层即注册

func Verify

func Verify(st interface{}, roleMap Rules) (err error)

Verify 校验方法

Types

type Rules

type Rules map[string][]string

type RulesMap

type RulesMap map[string]Rules

Jump to

Keyboard shortcuts

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