validatorrule

package
v0.0.0-...-b5ce554 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterValidationRule

func RegisterValidationRule(rule Rule, validate *validator.Validate, trans ut.Translator)

RegisterValidationRule ...

Types

type CommonRule

type CommonRule struct {
	Field     string
	FieldName string
	Message   string
}

CommonRule ...

func (*CommonRule) GetField

func (rule *CommonRule) GetField() string

GetField ...

func (*CommonRule) GetFieldName

func (rule *CommonRule) GetFieldName() string

GetFieldName ...

func (*CommonRule) GetMessage

func (rule *CommonRule) GetMessage() string

GetMessage ...

func (*CommonRule) RegisterFieldNameTranslate

func (rule *CommonRule) RegisterFieldNameTranslate(ut ut.Translator, fe validator.FieldError) string

RegisterFieldNameTranslate ...

func (*CommonRule) RegisterMessageTranslate

func (rule *CommonRule) RegisterMessageTranslate(ut ut.Translator) error

RegisterMessageTranslate ...

type ExampleRule

type ExampleRule struct{ *CommonRule }

ExampleRule ...

func NewExampleRule

func NewExampleRule() *ExampleRule

NewExampleRule ...

func (*ExampleRule) GetRule

func (*ExampleRule) GetRule() func(fl validator.FieldLevel) bool

GetRule ...

type Rule

type Rule interface {
	RegisterMessageTranslate(ut.Translator) error
	RegisterFieldNameTranslate(ut.Translator, validator.FieldError) string
	GetField() string
	GetFieldName() string
	GetMessage() string
	GetRule() func(fl validator.FieldLevel) bool
}

Rule ...

Jump to

Keyboard shortcuts

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