form

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DecodeError

type DecodeError struct {
	Field   string
	Message string
}

DecodeError describes a generated form decoding failure without exposing submitted values.

func (DecodeError) Error

func (err DecodeError) Error() string

type Field

type Field struct {
	Name string
}

Field describes one expected form field for generated decoders.

type Schema

type Schema struct {
	Fields []Field
}

Schema describes the submitted fields accepted by a generated decoder.

type Values

type Values map[string][]string

Values is the normalized representation passed to generated action decoders.

func DecodeExpected

func DecodeExpected(values Values, schema Schema) (Values, error)

DecodeExpected returns a copy of the submitted values restricted to the schema field allowlist. Missing expected fields are allowed; validation decides whether an absent value is acceptable.

func FromURLValues

func FromURLValues(values url.Values) Values

FromURLValues copies request form values into a stable runtime structure.

func (Values) All

func (values Values) All(name string) []string

All returns all submitted values for a field.

func (Values) First

func (values Values) First(name string) string

First returns the first submitted value for a field.

func (Values) HasSubmitted

func (values Values) HasSubmitted(name string) bool

HasSubmitted reports whether a field was submitted with at least one non-blank value.

func (Values) Names

func (values Values) Names() []string

Names returns submitted field names in stable order.

Jump to

Keyboard shortcuts

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