validator

package
v0.0.0-...-9be4a76 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2016 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(v interface{}) error

Types

type Error

type Error struct {
	Label string `json:"label"`
	Field string `json:"field"`
	Text  string `json:"text"`
}

type Errors

type Errors struct {
	Errors []Error `json:"errors"`
}

func FormatErrors

func FormatErrors(errs error) *Errors

func (Errors) Error

func (e Errors) Error() string

type Validator

type Validator struct {
	ValidatorHandler ValidatorHandler
	ErrorMessage     string
}

func New

func New(validatorHandler ValidatorHandler, errorMessage string) *Validator

func (*Validator) IsValid

func (this *Validator) IsValid(data string) error

type ValidatorHandler

type ValidatorHandler func(value string) bool

func IsDate

func IsDate() ValidatorHandler

func IsEmail

func IsEmail() ValidatorHandler

func IsEqual

func IsEqual(references ...string) ValidatorHandler

func IsNotEmpty

func IsNotEmpty() ValidatorHandler

func IsNumber

func IsNumber() ValidatorHandler

func IsV4UUID

func IsV4UUID() ValidatorHandler

func Regexp

func Regexp(pattern string) ValidatorHandler

Jump to

Keyboard shortcuts

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