formgen

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package formgen lowers captured form codecs into generated typed adapters. Callers supply physical declarations and selectors; this package never infers authored media policy from the generated Go representation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Application

func Application(application httpencoding.Application) string

Application renders the already resolved codec application.

func Presence

func Presence(context *codegen.AttributeContext, parent *expr.AttributeExpr, key string, physical *expr.AttributeExpr, value string) string

Presence renders the physical declaration's presence predicate. Empty values remain present; codec policy never follows Go wrapper shape inference.

Types

type Access

type Access struct {
	// Values and Name identify the raw form map and encoded field name.
	Values, Name string
	// Value is the allocated Go selector, without an address operator.
	Value string
	// Presence is an optional physical presence expression for encoding.
	Presence string
	// Required rejects absent values or zero emitted items where keys are evidence.
	Required bool
	// ErrorPrefix supplies other return values before an error (for example "\"\", ").
	ErrorPrefix string
	// Label names the field in diagnostics.
	Label string
}

Access supplies expressions at one emission site.

type Field

type Field struct {
	// Codec preserves the occurrence's style and value-versus-item application.
	Codec httpencoding.Codec
	// AllowsNull preserves explicit null admission for JSON values.
	AllowsNull bool
}

Field binds a captured codec to one typed form value.

func (Field) DecodeCall

func (field Field) DecodeCall(values, name, value string) string

DecodeCall renders one typed leaf decode without reflection-based policy inference.

func (Field) Encode

func (field Field) Encode(access Access) string

Encode renders presence and required-item checks around a captured leaf call.

func (Field) EncodeCall

func (field Field) EncodeCall(values, name, value string) string

EncodeCall renders one JSON or native leaf call, retaining captured policy.

Jump to

Keyboard shortcuts

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