binding

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Form     = formBinding{}
	Query    = queryBinding{}
	FormPost = formPostBinding{}
)

These implement the Binding interface and can be used to bind the data present in the request to struct instances.

View Source
var (

	// ErrConvertMapStringSlice can not convert to map[string][]string
	ErrConvertMapStringSlice = errors.New("can not convert to map slices of strings")
	// ErrConvertToMapString can not convert to map[string]string
	ErrConvertToMapString = errors.New("can not convert to map of strings")
)

Functions

func MapFormWithTag

func MapFormWithTag(ptr any, form map[string][]string, tag string) error

MapFormWithTag map form with tag.

Types

type Binding

type Binding interface {
	Name() string
	Bind(*http.Request, any) error
}

Binding describes the interface which needs to be implemented for binding the data present in the request such as JSON request body, query parameters or the form POST.

Jump to

Keyboard shortcuts

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