forms

package
v0.0.0-...-76f7c0c Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Form

type Form struct {
	// typically used for query parameters and form values
	url.Values `json:"-"`
	Errors     errors `json:"errors"`
}

func New

func New(data url.Values) *Form

func (*Form) Has

func (f *Form) Has(field string, req *http.Request) bool

Checks if the form submitted by the user has a specified field

func (*Form) Marshal

func (f *Form) Marshal() ([]byte, error)

Marshal returns the json encoding of form errors

func (*Form) MinLength

func (f *Form) MinLength(field string, length int, r *http.Request) bool

Checks for string minimum length

func (*Form) Required

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

Checks for required fields

func (*Form) Valid

func (f *Form) Valid() bool

Returns true if there are no errors

func (*Form) ValidEmail

func (f *Form) ValidEmail(field string)

Checks for valid email address

Jump to

Keyboard shortcuts

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