validator

package
v0.0.0-...-2f1df5c Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NotBlank

func NotBlank(s string) bool

NotBlank reports whether the string s is not blank.

Types

type Validator

type Validator struct {
	Errors      []string
	FieldErrors map[string]string
}

Validator contains errors messages for forms and their fields.

func (*Validator) AddError

func (v *Validator) AddError(message string)

AddError adds the form error message to the Validator.

func (*Validator) AddFieldError

func (v *Validator) AddFieldError(key string, message string)

AddFieldError adds the field error message to the Validator.

func (*Validator) Check

func (v *Validator) Check(ok bool, message string)

Check adds the form error message to the Validator if the validation check fails.

func (*Validator) CheckField

func (v *Validator) CheckField(ok bool, key string, message string)

CheckField adds the field error message to the Validator if the validation check fails.

func (*Validator) HasErrors

func (v *Validator) HasErrors() bool

HasErrors reports whether the Validator contains any error messages.

Jump to

Keyboard shortcuts

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