validation

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinNameLength    = 1
	MaxNameLength    = 100
	MinMessageLength = 1
	MaxMessageLength = 1000
	NameField        = "name"
	EmailField       = "email"
	MessageField     = "message"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContactFormValidator

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

func NewContactFormValidator

func NewContactFormValidator() *ContactFormValidator

func (*ContactFormValidator) Check

func (v *ContactFormValidator) Check(request any)

func (*ContactFormValidator) FieldErrors

func (v *ContactFormValidator) FieldErrors() map[string]string

func (*ContactFormValidator) GlobalError

func (v *ContactFormValidator) GlobalError() string

func (*ContactFormValidator) Valid

func (v *ContactFormValidator) Valid() bool

type Validator

type Validator interface {
	Check(request any)
	Valid() bool
	FieldErrors() map[string]string
	GlobalError() string
}

Define interface for validation

Jump to

Keyboard shortcuts

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