binding

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBinders = []Binder{&TimeBinder{}, &BaseBinder{}}

Functions

func Bind

func Bind(i interface{}, s string, binders ...Binder) error

func BindList

func BindList(i interface{}, ss []string, binders ...Binder) error

func BindStruct

func BindStruct(i interface{}, values map[string][]string, binders ...Binder) error

func BindStructFunc

func BindStructFunc(i interface{}, valuesFn func(string) []string, binders ...Binder) error

Types

type BaseBinder

type BaseBinder struct{}

func (*BaseBinder) Bind

func (b *BaseBinder) Bind(rv reflect.Value, v string) error

func (*BaseBinder) Match

func (b *BaseBinder) Match(rv reflect.Value) bool

type Binder

type Binder interface {
	Match(rv reflect.Value) bool
	Bind(rv reflect.Value, s string) error
}

type TimeBinder

type TimeBinder struct {
	Layout   string
	Location *time.Location
}

func (*TimeBinder) Bind

func (b *TimeBinder) Bind(rv reflect.Value, v string) error

func (*TimeBinder) Match

func (b *TimeBinder) Match(rv reflect.Value) bool

Jump to

Keyboard shortcuts

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