map_validator

package
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoData            = errors.New("no validatorType")
	ErrInvalidJsonFormat = errors.New("is not valid json")
	ErrUnsupportType     = errors.New("type is not support")
)

Functions

func NewValidateBuilder

func NewValidateBuilder() *ruleState

func SetMessage added in v0.0.18

func SetMessage(msg string) *string

func SetTotal added in v0.0.7

func SetTotal(total int64) *int64

Types

type CustomMsg

type CustomMsg struct {
	OnTypeNotMatch *string
	//OnEnumValueNotMatch *string
	//OnNull              *string
	OnMax         *string
	OnMin         *string
	OnRegexString *string
}

type EnumField

type EnumField[T any] struct {
	Items               T
	StringCaseSensitive bool // will support soon
}

type ExtensionType added in v0.0.20

type ExtensionType interface {
	SetRoles(rules RulesWrapper)
	BeforeLoad(data interface{}) error
	AfterLoad(data *map[string]interface{}) error
	BeforeValidation(data *map[string]interface{}) error
	AfterValidation(data *map[string]interface{}) error
	SetExtraData(data *ExtraOperationData) ExtensionType
}

type ExtraOperationData added in v0.0.20

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

func (*ExtraOperationData) Bind added in v0.0.20

func (state *ExtraOperationData) Bind(i interface{}) error

func (*ExtraOperationData) GetData added in v0.0.20

func (state *ExtraOperationData) GetData() map[string]interface{}

func (*ExtraOperationData) GetFilledField added in v0.0.20

func (state *ExtraOperationData) GetFilledField() []string

func (*ExtraOperationData) GetNullField added in v0.0.20

func (state *ExtraOperationData) GetNullField() []string

type ExtraOperationType added in v0.0.20

type ExtraOperationType interface {
	Bind(i interface{}) error
	GetFilledField() []string
	GetNullField() []string
	GetData() map[string]interface{}
}

type FileRequest

type FileRequest struct {
	File     multipart.File
	FileInfo *multipart.FileHeader
}

type MessageMeta added in v0.0.18

type MessageMeta struct {
	Field             *string
	ExpectedType      *reflect.Kind
	ActualLength      *int64
	ExpectedMinLength *int64
	ExpectedMaxLength *int64
	ActualType        *reflect.Kind
}

type Rules

type Rules struct {
	Null               bool
	NilIfNull          bool
	AnonymousObject    bool
	Email              bool
	Enum               *EnumField[any]
	Type               reflect.Kind
	Max                *int64
	Min                *int64
	IfNull             interface{}
	UUID               bool
	UUIDToString       bool
	IPV4               bool
	IPV4Network        bool
	IPv4OptionalPrefix bool
	File               bool
	RegexString        string
	Unique             []string
	RequiredWithout    []string
	Object             *RulesWrapper
	ListObject         *RulesWrapper

	CustomMsg CustomMsg // will support soon
}

type RulesWrapper added in v0.0.22

type RulesWrapper struct {
	Rules   map[string]Rules
	Setting Setting
	// contains filtered or unexported fields
}

type Setting added in v0.0.22

type Setting struct {
	Strict bool
}

Jump to

Keyboard shortcuts

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