decoder

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: MIT Imports: 6 Imported by: ? 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

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedType = errors.New("decoder: unsupported type")

Functions

This section is empty.

Types

type CachedDecoder

type CachedDecoder struct {
	// contains filtered or unexported fields
}

func NewCachedDecoder

func NewCachedDecoder(v interface{}, tag string) (*CachedDecoder, error)

func (*CachedDecoder) Decode

func (d *CachedDecoder) Decode(data Getter, v interface{}) error

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

func NewDecoder

func NewDecoder(tag string) *Decoder

func (*Decoder) Decode

func (d *Decoder) Decode(data Getter, v any) (err error)

type Getter

type Getter interface {
	Get(string) string
	Values(string) []string
}

type MapDecoder

type MapDecoder struct {
	// contains filtered or unexported fields
}

func NewMapDecoder

func NewMapDecoder(v interface{}, tag string) (*MapDecoder, error)

func (*MapDecoder) Decode

func (d *MapDecoder) Decode(data map[string][]string, v interface{}) error

type MapGetter

type MapGetter map[string][]string

func (MapGetter) Get

func (m MapGetter) Get(key string) string

func (MapGetter) Values

func (m MapGetter) Values(key string) []string

type ParamsDecoder

type ParamsDecoder struct {
	// contains filtered or unexported fields
}

func NewParamsDecoder

func NewParamsDecoder(v interface{}, tag string) (*ParamsDecoder, error)

func (*ParamsDecoder) Decode

func (d *ParamsDecoder) Decode(data []httprouter.Param, v interface{}) error

type ParamsGetter

type ParamsGetter []httprouter.Param

func (ParamsGetter) Get

func (ps ParamsGetter) Get(key string) string

func (ParamsGetter) Values

func (ps ParamsGetter) Values(key string) []string

Jump to

Keyboard shortcuts

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