validate

package
v2.0.0-...-caf96b7 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ValidatorRegistry = make(map[string]ValidatorFunc)

Validator registry

Functions

func Failed

func Failed(fv FieldValidator, errStr, got string) error

func NewValidationError

func NewValidationError(errors []error) *validationError

func Passed

func Passed(fv FieldValidator, value, test string) error

func RegisterValidator

func RegisterValidator(name string, fn ValidatorFunc) error

RegisterValidator registers a new validator function if it does not already exist. If it does, it returns an error.

func TryConnect

func TryConnect(chain, providerUrl string, maxAttempts int) error

func Validate

func Validate(input interface{}) error

Types

type Enabler

type Enabler interface {
	IsEnabled() bool
}

type FieldValidator

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

FieldValidator holds everything needed to validate a single field.

func NewFieldValidator

func NewFieldValidator(name, typ, fld, ctx string) FieldValidator

func (FieldValidator) Context

func (fv FieldValidator) Context() string

func (FieldValidator) Root

func (fv FieldValidator) Root() interface{}

type ValidatorFunc

type ValidatorFunc func(fv FieldValidator) error

ValidatorFunc defines the signature for validation functions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳