validator

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 28, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field interface {
	Name() string
	Value() interface{}
	TypeName() string
	ValidateIfExists() bool
	HideParentName() bool
	Omitempty() bool
	IsStruct() bool
	IsSlice() bool
	IsRequired() bool
	MustValidateType() bool
	Hints() []string

	IsValid() ([]rules.FieldError, bool)
	GenerateNestedFields() []Field
	GenerateRules() []rules.Rule
	ExtractValueFrom(data map[string]interface{}) interface{}

	SetName(value string)
	SetValue(value interface{})
	SetValidateIfExists(value bool)
}

type ValidationError

type ValidationError interface {
	String() string
	Messages() []string
	Fields() []string
	RuleTypes() []string
	FieldsErrors() []rules.FieldError
}

func ValidateDTO

func ValidateDTO[T interface{}](data interface{}) (*T, ValidationError)

func ValidateDTOPartially

func ValidateDTOPartially[T interface{}](data interface{}) (*T, ValidationError)

Jump to

Keyboard shortcuts

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