rule

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// NotEmpty is a rule implemented
	NotEmpty = &notEmpty{}

	// Required is a rule implemented
	Required = &required{}

	// Max is a rule implemented
	Max = &max{}

	// Min is a rule implemented
	Min = &min{}

	// Enum is a rule implemented
	Enum = &enum{}

	// MaxBound is a rule implemented
	MaxBound = &maxBound{}

	// MinBound is a rule implemented
	MinBound = &minBound{}
)

Functions

This section is empty.

Types

type ErrEnum

type ErrEnum struct {
	Field string
	Value string
	Enum  []string
}

ErrEnum is the representation about any error happened inside of the rule Enum

func (*ErrEnum) Error

func (err *ErrEnum) Error() string

type ErrMax

type ErrMax struct {
	Field string
	Value int
	Max   int
}

ErrMax is the representation about any error happened inside of the rule Max

func (*ErrMax) Error

func (err *ErrMax) Error() string

type ErrMaxBound

type ErrMaxBound struct {
	Field string
	Value string
	Bound int
}

ErrMaxBound is the representation about any error happened inside of the rule MaxBound

func (*ErrMaxBound) Error

func (err *ErrMaxBound) Error() string

type ErrMin

type ErrMin struct {
	Field string
	Value int
	Min   int
}

ErrMin is the representation about any error happened inside of the rule Min

func (*ErrMin) Error

func (err *ErrMin) Error() string

type ErrMinBound

type ErrMinBound struct {
	Field string
	Value string
	Bound int
}

ErrMinBound is the representation about any error happened inside of the rule MinBound

func (*ErrMinBound) Error

func (err *ErrMinBound) Error() string

type ErrNotEmpty added in v1.1.0

type ErrNotEmpty struct {
	Field string
}

ErrNotEmpty is the representation about any error happened inside of the rule NotEmpty

func (*ErrNotEmpty) Error added in v1.1.0

func (e *ErrNotEmpty) Error() string

type ErrRequired

type ErrRequired struct {
	Field string
}

ErrRequired is the representation about any error happened inside of the rule Required

func (*ErrRequired) Error

func (e *ErrRequired) Error() string

type Rule

type Rule interface {
	Name() string
	Validate(name, value, param string) (bool, error)
}

Rule is a interface with the contract to implement a any rule

Jump to

Keyboard shortcuts

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