rvalid

package
v0.0.0-...-bac8e5f Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Valid

func Valid(field interface{}, tag string) error

func ValidForm

func ValidForm(v interface{}) error

验证实例字段 use for example:

import
user = &struct {
	Appid string `validate:"required,appid"`
	SN    string `validate:"required,sn"`
}{
	SN:    "102102000100008F",
	Appid: "TI1ZDE1NzJhZTEwO",
}

if err := rvalid.ValidField(user); err != nil {
	fmt.Println(err)
	rvalid.NewErrResp(-422, err.Error(), "")
}

func ValidatorReg

func ValidatorReg(tag string, f valid.Func) error

运行时动态加入验证规则

Types

This section is empty.

Jump to

Keyboard shortcuts

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