complicated

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AliasOnDogsMapAlias

type AliasOnDogsMapAlias DogsMapAlias

func (AliasOnDogsMapAlias) Validate

func (r AliasOnDogsMapAlias) Validate() error

Validate validates AliasOnDogsMapAlias

func (AliasOnDogsMapAlias) ValidateAlias

func (r AliasOnDogsMapAlias) ValidateAlias() error

type Dog

type Dog struct {
	Name string `validate:"min_len=1,max_len=64"`
}

func (Dog) Validate

func (r Dog) Validate() error

Validate validates Dog

func (Dog) ValidateOptional

func (Dog) ValidateOptional() error

type DogsMapAlias

type DogsMapAlias map[string]Dog

func (DogsMapAlias) Validate

func (r DogsMapAlias) Validate() error

Validate validates DogsMapAlias

type InterfaceToSkip

type InterfaceToSkip interface {
	Method()
	Can()
}

type State

type State int
const (
	StateOk    State = 200
	StateError State = 400
)

func (State) Validate

func (s State) Validate() error

type Status

type Status string
const (
	StatusCreated Status = "created"
	StatusPending Status = "pending"
	StatusActive  Status = "active"
	StatusFailed  Status = "failed"
)

func (Status) Validate

func (r Status) Validate() error

Validate validates Status

type User

type User struct {
	Name                           string  `validate:"min_len=3,max_len=64"`
	LastName                       *string `json:"last_name" validate:"nullable,min_len=1,max_len=5"`
	Age                            uint    `validate:"min=18,max=105"`
	ChildrenCount                  *int    `json:"children_count" validate:"not_null,min=0,max=15"`
	Float                          float64 `validate:"min=-4.22,max=42.55"`
	Dog                            Dog
	DogPointer                     *Dog
	DogOptional                    Dog      `validate:"func=.ValidateOptional"`
	Urls                           []string `validate:"min_items=1,item=[max_len=256]"`
	Dogs                           []*Dog   `validate:"min_items=1,item=[nullable]"`
	Test                           *[]int   `validate:"nullable,min_items=1,item=[min=4]"`
	Flag                           bool
	Some                           interface{}    `validate:"func=validateSome"`
	SomeArray                      []interface{}  `validate:"min_items=1,item=[func=validateSome]"`
	Dict                           map[string]int `validate:"min_items=2,key=[max_len=64],value=[min=-35,max=34]"`
	DictDogs                       map[string]Dog `validate:"value=[func=.ValidateOptional;validateMaxDogName]"`
	Alias                          DogsMapAlias
	AliasOnAlias                   AliasOnDogsMapAlias
	AliasOnAliasWithCustomValidate AliasOnDogsMapAlias       `validate:"func=.ValidateAlias"`
	MapOfMap                       map[string]map[int]string `validate:"key=[min_len=3],value=[min_items=1,value=[min_len=3]]"`
	MapOfSlice                     map[string][]string       `validate:"value=[min_items=1,item=[max_len=256]]"`
	SliceOfMap                     []map[string]int          `validate:"item=[min_items=1,key=[min_len=3],value=[min=1]]"`
	SliceOfSliceOfSlice            [][][]string              `validate:"min_items=1,item=[min_items=1,item=[min_items=1,item=[max_len=256]]]"`
	MapWithoutValidation           map[string]interface{}
	SliceWithoutValidation         []interface{}
	FuncField                      func(int) string
	ChanField                      <-chan int
	ByteField                      byte
	ByteArray                      []byte
}

func (User) Validate

func (r User) Validate() error

Validate validates User

Jump to

Keyboard shortcuts

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