valid

package
v0.0.0-...-201756f Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2015 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	Name string
	// contains filtered or unexported fields
}

func (*Field) Check

func (f *Field) Check() error

func (*Field) FieldErr

func (f *Field) FieldErr(errName string)

func (*Field) Int64

func (f *Field) Int64(v int64) *Int64Field

func (*Field) RequiredErr

func (f *Field) RequiredErr()

func (*Field) String

func (f *Field) String(v string) *StringField

type FieldErr

type FieldErr struct {
	// The name of the struct field with the error.
	Field string `json:"field"`

	// The name of the validation.
	Tag string `json:"tag"`

	// The human readable error.
	Msg string `json:"msg"`
}

func NewFieldError

func NewFieldError(field, tag string) *FieldErr

func (*FieldErr) Error

func (err *FieldErr) Error() string

Error implemented to satisfy the error interface

func (*FieldErr) StatusCode

func (err *FieldErr) StatusCode() int

StatusCode implemented to satisfy HTTPErr

type Int64Field

type Int64Field struct {
	F     *Field
	Value int64
}

func (*Int64Field) Equal

func (f *Int64Field) Equal(v int64) *Int64Field

func (*Int64Field) Required

func (f *Int64Field) Required() *Int64Field

type StringField

type StringField struct {
	F     *Field
	Value string
}

func (*StringField) Enum

func (f *StringField) Enum(vals []string) *StringField

func (*StringField) Equal

func (f *StringField) Equal(v string) *StringField

func (*StringField) Required

func (f *StringField) Required() *StringField

type V

type V struct {
	// contains filtered or unexported fields
}

func New

func New() *V

func (*V) Check

func (v *V) Check(names ...string) error

Check returns an error for the first validation failed. if `names` are provided, only fields with the given name are checked.

func (*V) F

func (v *V) F(name string) *Field

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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