mvalid

package
v0.0.0-...-670bf6b Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2017 License: Apache-2.0, Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TAG_VALIDATOR = "validator"
	V_REQUIRED    = "required"
	V_MIN         = "min"
	V_MAX         = "max"
	V_MIN_LENGTH  = "minlength"
	V_MAX_LENGTH  = "maxlength"
	V_EMAIL       = "email"
	V_IDCARD      = "idcard"
	V_REGEX       = "regex"
	V_NUMBER      = "number"
	V_PHONE       = "phone"
	V_LENGTH      = "length"
)

Variables

This section is empty.

Functions

func GetValidatorTag

func GetValidatorTag(v interface{}, fn string) string

func PrintValidate

func PrintValidate(v interface{})

func Validate

func Validate(v interface{}) map[string]string

Validate

func ValidateField

func ValidateField(v interface{}, fn string) (err string)

ValidateField

Types

type RequiredValidator

type RequiredValidator struct {
	Value interface{}
	Field string
	Validator
}

func NewRequiredValidator

func NewRequiredValidator(v interface{}, field string) *RequiredValidator

func (*RequiredValidator) Validate

func (vd *RequiredValidator) Validate() (bool, string)

Validate implement Validator.

type Validator

type Validator interface {
	// run validate
	// Validator provide Validate method.
	Validate() (bool, string)
}

Validator

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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