validation

package
v0.0.0-...-4ca5139 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendOptions

func AppendOptions(validator *validate.Validation, options map[string]any)

func Attributes

func Attributes(attributes map[string]string) httpvalidate.Option

func CustomRules

func CustomRules(rules []httpvalidate.Rule) httpvalidate.Option

func GenerateOptions

func GenerateOptions(options []httpvalidate.Option) map[string]any

func Messages

func Messages(messages map[string]string) httpvalidate.Option

func PrepareForValidation

func PrepareForValidation(prepare func(data httpvalidate.Data) error) httpvalidate.Option

func Rules

func Rules(rules map[string]string) httpvalidate.Option

Types

type Data

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

func NewData

func NewData(data validate.DataFace) *Data

func (*Data) Get

func (d *Data) Get(key string) (val any, exist bool)

func (*Data) Set

func (d *Data) Set(key string, val any) error

type Errors

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

func NewErrors

func NewErrors(errors validate.Errors) *Errors

func (*Errors) All

func (r *Errors) All() map[string]map[string]string

func (*Errors) Get

func (r *Errors) Get(key string) map[string]string

func (*Errors) Has

func (r *Errors) Has(key string) bool

func (*Errors) One

func (r *Errors) One(key ...string) string

type ServiceProvider

type ServiceProvider struct {
}

func (*ServiceProvider) Boot

func (database *ServiceProvider) Boot()

func (*ServiceProvider) Register

func (database *ServiceProvider) Register()

type Validation

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

func NewValidation

func NewValidation() *Validation

func (*Validation) AddRules

func (r *Validation) AddRules(rules []validatecontract.Rule) error

func (*Validation) Make

func (r *Validation) Make(data any, rules map[string]string, options ...validatecontract.Option) (validatecontract.Validator, error)

func (*Validation) Rules

func (r *Validation) Rules() []validatecontract.Rule

type Validator

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

func NewValidator

func NewValidator(instance *validate.Validation, data validate.DataFace) *Validator

func (*Validator) Bind

func (v *Validator) Bind(ptr any) error

func (*Validator) Errors

func (v *Validator) Errors() httpvalidate.Errors

func (*Validator) Fails

func (v *Validator) Fails() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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