form

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMaxFormBody = 10 << 20
View Source
const RecordTimeLayout = "2006-01-02T15:04"

Variables

View Source
var (
	ErrNotAPointer = errors.New("coyote/form: target must be a pointer to a struct")
)

Functions

func Parse

func Parse(r *http.Request, maxBytes int64) error

func Register

func Register(name string, rule Rule)

Types

type Bound

type Bound struct {
	Record   model.Record
	Problems Problems
}

func Record

func Record(values url.Values, schema *model.Schema, creating bool) Bound

func RecordOf

func RecordOf(values url.Values, schema *model.Schema, fields []model.Field, creating bool) Bound

func (Bound) Errors

func (b Bound) Errors() map[string]string

func (Bound) Valid

func (b Bound) Valid() bool

type Problems

type Problems map[string][]string

func Bind

func Bind(r *http.Request, target any) (Problems, error)

func BindQuery

func BindQuery(r *http.Request, target any) (Problems, error)

func Values

func Values(values map[string][]string, target any) (Problems, error)

func (Problems) Add

func (p Problems) Add(field, message string)

func (Problems) Any

func (p Problems) Any() bool

func (Problems) Error

func (p Problems) Error() string

func (Problems) Fields

func (p Problems) Fields() []string

func (Problems) First

func (p Problems) First(field string) string

func (Problems) Has

func (p Problems) Has(field string) bool

type Rule

type Rule func(value string, arg string) error

Jump to

Keyboard shortcuts

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