form

package
v2.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package form provides helpers to work with form validation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Form

type Form struct {
	url.Values
	Errors errors
}

func New

func New(data url.Values) *Form

New initializes a form struct.

func (*Form) Has

func (f *Form) Has(field string) bool

Has checks if form field is in post and not empty.

func (*Form) IsEmail

func (f *Form) IsEmail(field string)

IsEmail checks for valid email address.

func (*Form) MaxLength

func (f *Form) MaxLength(field string, length int) bool

MaxLength checks for string maximum length.

func (*Form) MinLength

func (f *Form) MinLength(field string, length int) bool

MinLength checks for string minimum length.

func (*Form) Required

func (f *Form) Required(fields ...string)

Required checks for required fields.

func (*Form) Valid

func (f *Form) Valid() bool

Valid returns true if no errors.

Jump to

Keyboard shortcuts

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