validate

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 5 Imported by: 0

README

validate

Documentation

Index

Constants

View Source
const (
	MESSAGE_REQUIRED = "Validation: Field '%s' is required"
	MESSAGE_BLANK    = "Validation: Field '%s' failed is %s"
	MESSAGE_EMAIL    = "Validation: Field '%s' is invalid"

	MESSAGE_CPF_AND_CNPJ = "Validation: Field '%s' is invalid"

	MESSAGE_MIM_MAX = "Validation: Field '%s' failed the %s length of %s characters"

	MESSAGE_GREATE_THEN = "Validation: Field '%s' failed greater than or equal = '%s'"
	MESSAGE_LESS_THEN   = "Validation: Field '%s' failed less than or equal = '%s'"

	MESSAGE_DEFAULT          = "Validation: Field '%s' failed on the '%s = %s'"
	MESSAGE_DEFAULT_NO_PARAM = "Validation: Field '%s' failed on the '%s'"
)

Variables

This section is empty.

Functions

func MessageValidation

func MessageValidation(fe validator.FieldError) string

Types

type FieldValidation

type FieldValidation struct {
	Field   string
	Message string
}

type Service

type Service struct {
}

func (*Service) Struct added in v1.0.1

func (s *Service) Struct(strt interface{}) (messageValidate []FieldValidation, err error)

type Validate added in v1.0.1

type Validate interface {
	Struct(strt interface{}) (messageValidate []FieldValidation, err error)
}

func NewValidate

func NewValidate() Validate

type ValidationBuilder

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

func NewFieldValidationBuilder

func NewFieldValidationBuilder() *ValidationBuilder

NewFieldValidationBuilder creates a new ValidationBuilder

func (*ValidationBuilder) Build

func (b *ValidationBuilder) Build() *FieldValidation

Build creates the final FieldValidation object using the values defined in the ValidationBuilder

func (*ValidationBuilder) Field

func (b *ValidationBuilder) Field(field string) *ValidationBuilder

Field sets the field of the ValidationBuilder

func (*ValidationBuilder) Message

func (b *ValidationBuilder) Message(message string) *ValidationBuilder

Message sets the message of the ValidationBuilder

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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