validator

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoolValidator

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

BoolValidator implements Validator which used to valite a boolean value should be true

func (BoolValidator) Validate

func (v BoolValidator) Validate() error

type Validator

type Validator interface {
	Validate() error
}

func NewBoolValidator

func NewBoolValidator(val bool, msg string) Validator

type ValidatorFunc

type ValidatorFunc func() error

ValidatorFunc represents a function which implements Validator interface

func (ValidatorFunc) Validate

func (v ValidatorFunc) Validate() error

type ValidatorList

type ValidatorList []Validator

ValidatorList holds n Validators, and implements Validator interface too

func NewSet

func NewSet() *ValidatorList

func Require

func Require(val bool, msg string) *ValidatorList

Require returns a ValidatorList which holds a boolValidator created by (val,msg)

func (*ValidatorList) And

func (v *ValidatorList) And(validator Validator) *ValidatorList

And appends a Validator

func (*ValidatorList) AndRequire

func (v *ValidatorList) AndRequire(val bool, msg string) *ValidatorList

AndRequire appends a boolValidator

func (ValidatorList) Validate

func (v ValidatorList) Validate() error

Jump to

Keyboard shortcuts

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