Documentation
¶
Index ¶
- type Binder
- func (b *Binder) Bind(target any) error
- func (b *Binder) BindJSON(target any, data []byte) error
- func (b *Binder) FromFunc(tag string, fn SourceFunc) *Binder
- func (b *Binder) FromHeader(r *http.Request) *Binder
- func (b *Binder) FromPath(fn SourceFunc) *Binder
- func (b *Binder) FromQuery(r *http.Request) *Binder
- type SourceFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Binder ¶
type Binder struct {
// contains filtered or unexported fields
}
Binder populates struct fields from path, query, header, and default sources.
func (*Binder) Bind ¶
Bind populates struct fields from all registered sources, then applies defaults.
func (*Binder) FromFunc ¶
func (b *Binder) FromFunc(tag string, fn SourceFunc) *Binder
FromFunc adds a custom source with the given tag name.
func (*Binder) FromHeader ¶
FromHeader adds an HTTP header source.
func (*Binder) FromPath ¶
func (b *Binder) FromPath(fn SourceFunc) *Binder
FromPath adds a path parameter source.
type SourceFunc ¶
SourceFunc extracts a string value by key from a request source.
Click to show internal directories.
Click to hide internal directories.