check

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(s interface{}, rules Rules) (err error)

Check *

  • @Description: 对结构体内置数据类型根据validator库进行校验
  • (不支持slice、array、struct、map、channel、interface、function类型)
  • @param s
  • @param rules
  • @return err

func CheckField

func CheckField(field interface{}, tag string) (errs error)

CheckField *

  • @Description: 字段校验
  • @param field 字段实例("joeybloggs.gmail.com")
  • @param tag 校验标签("required,email")
  • @return errs 返回错误

func CheckStruct

func CheckStruct(s interface{}) (errF validator.FieldError)

CheckStruct *

  • @Description: 校验结构体
  • @param s 结构体
  • @return errF 错误

func CheckValue

func CheckValue(v reflect.Value, rule string) (err error)

CheckValue *

  • @Description: 字段值校验
  • @param v
  • @param rule
  • @return err

Types

type Rules

type Rules map[string]string

Jump to

Keyboard shortcuts

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