validators

package
v0.0.0-...-e2e76ad Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnumIsInRange

type EnumIsInRange struct {
	Name    string
	Field   int
	Message string
	Start   int
	End     int
}

EnumIsInRange packages the int value of an enum, along with its name and exclusive min-max values, for validation. To call this validator on an enum, set Field: int(<enum>), where <enum> could be any enum with an underlying int (or similar) type. The Start and End values must be exclusive bounds, ie. 1 less than the minimum possible value and 1 more than the minimum possible value, respectively.

func (*EnumIsInRange) IsValid

func (v *EnumIsInRange) IsValid(errors *validate.Errors)

IsValid : Validates that the value of the enum falls within the acceptable range of numerical enum values

type IsNotNull

type IsNotNull struct {
	Name    string
	Field   nulls.Nulls
	Message string
}

IsNotNull packages Nulls type (ie. any type that implements the nullable interface) with its name and message for validation. To call this validator on a nullable value, set Field: nulls.Nulls{Value: <nullable>}, where <nullable> could be nulls.Int, nulls.String, etc.

func (*IsNotNull) IsValid

func (v *IsNotNull) IsValid(errors *validate.Errors)

IsValid checks if nullable field is null; if so returns error

Jump to

Keyboard shortcuts

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