validate

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(validator Validator, value any, rules ...Rule) error

Types

type Errors

type Errors map[string]error

func (Errors) Error

func (e Errors) Error() string

type Field

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

type InternalError

type InternalError struct {
	Err error
}

func NewInternalError

func NewInternalError(err error) InternalError

func (InternalError) Error

func (e InternalError) Error() string

type NormalValidator

type NormalValidator struct{}

func (*NormalValidator) Field

func (*NormalValidator) Field(p any, rules ...Rule) *Field

func (*NormalValidator) Struct

func (v *NormalValidator) Struct(p any, fields ...*Field) error

type Rule

type Rule interface {
	Validate(value interface{}) error
}

type Validatable

type Validatable interface {
	Validate(validator Validator) error
}

type Validator

type Validator interface {
	Struct(p any, fields ...*Field) error
	Field(p any, rules ...Rule) *Field
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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