validator

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MeetingTimeValidator = CustomValidationFunc{
	Tag:                      "valid meeting time",
	Func:                     meetingTimeValidateFunc,
	CallValidationEvenIfNull: false,
}

MeetingTimeValidator is a CustomValidationFunc that requires a string to be in RFC3339 format.

View Source
var (
	// ProviderSet provides a Validator.
	ProviderSet = wire.NewSet(Provide, Cfg, ProvideCustomValidationFuncs)
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Engine                ValidationEngine
	CustomValidationFuncs []CustomValidationFunc
}

Config is used to configure a Validator with the containing Engine and CustomValidationFuncs.

func Cfg

func Cfg(customValidationFuncs []CustomValidationFunc) Config

Cfg returns a new Config containing the given slice of CustomValidationFuncs.

type CustomValidationFunc

type CustomValidationFunc struct {
	Tag                      string
	Func                     validator.Func
	CallValidationEvenIfNull bool
}

CustomValidationFunc represents a custom validation function and other associated properties.

func ProvideCustomValidationFuncs

func ProvideCustomValidationFuncs() []CustomValidationFunc

ProvideCustomValidationFuncs provides a slice of CustomValidationFuncs used in the application.

type ValidationEngine

type ValidationEngine interface{}

type Validator

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

Validator contains the components needed to perform validation within the application.

func NewValidator

func NewValidator(config Config) (*Validator, error)

NewValidator returns a new Validator configured using the provided Config and also initializes the Validator for use.

func Provide

func Provide(config Config) (*Validator, error)

Provide provides a new Validator using the given Config.

Jump to

Keyboard shortcuts

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