validation

package
v1.1.13 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendOptions

func AppendOptions(ctx *frame.Context, 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)) httpvalidate.Option

func Rules

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

func Validate

func Validate(ctx *frame.Context, rules map[string]string, options ...validation.Option) (validation.Validator, error)

func ValidateRequest

func ValidateRequest(ctx *frame.Context, request http.FormRequest) (validation.Errors, error)

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 []validation.Rule) error

func (*Validation) Make

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

func (*Validation) Rules

func (r *Validation) Rules() []validation.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