validation

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Message

func Message(defaultMsg string, customMsgAndArgs ...interface{}) string

Types

type ValidationError

type ValidationError struct {
	Key     string
	Value   interface{}
	Message string
	// contains filtered or unexported fields
}

ValidationError represents a validation error against a specific field.

func (*ValidationError) Error

func (e *ValidationError) Error() string

func (*ValidationError) Next

func (e *ValidationError) Next() *ValidationError

func (*ValidationError) Prev

func (e *ValidationError) Prev() *ValidationError

type ValidationErrors

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

func NewValidationErrors

func NewValidationErrors() *ValidationErrors

func (*ValidationErrors) First

func (ve *ValidationErrors) First() *ValidationError

func (*ValidationErrors) Get

func (ve *ValidationErrors) Get(key string) *ValidationError

func (*ValidationErrors) Last

func (ve *ValidationErrors) Last() *ValidationError

func (*ValidationErrors) Len

func (ve *ValidationErrors) Len() int

func (*ValidationErrors) Set

func (ve *ValidationErrors) Set(key string, value interface{}, message string)

type Validator

type Validator struct {
	Errors *ValidationErrors
}

func NewValidator

func NewValidator() *Validator

func (*Validator) HasErrors

func (v *Validator) HasErrors() bool

func (*Validator) Required

func (v *Validator) Required(key string, value interface{}, msgAndArgs ...interface{}) bool

func (*Validator) SetError

func (v *Validator) SetError(key string, value interface{}, message string)

Jump to

Keyboard shortcuts

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