bind

package
v0.0.0-...-3839eb7 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BindingJson   = JsonBinding{}
	BindingXml    = XmlBinding{}
	BingQuery     = QueryBinding{}
	BindingYaml   = YamlBinding{}
	BindingToml   = TomlBinding{}
	BindingHeader = HeaderBinding{}
	BindingUri    = UriBinding{}
)
View Source
var HandlerChain []Handler

Functions

func Bind

func Bind(ctx *gin.Context, pair BindPair) error

func Binds

func Binds(ctx *gin.Context, pairs ...BindPair) error

Types

type BindPair

type BindPair struct {
	B Binding
	V vax.Validatable
}
func Header(val vax.Validatable) BindPair

func Json

func Json(val vax.Validatable) BindPair

func Pair

func Pair(b Binding, val vax.Validatable) BindPair

func Query

func Query(val vax.Validatable) BindPair

func Toml

func Toml(val vax.Validatable) BindPair

func Uri

func Uri(val vax.Validatable) BindPair

func Xml

func Xml(val vax.Validatable) BindPair

func Yaml

func Yaml(val vax.Validatable) BindPair

type Binding

type Binding interface {
	Bind(ctx *gin.Context, val vax.Validatable) error
}

type Handler

type Handler func(ctx *gin.Context, bindErr error)

Handler will be called when bind error occurs

type HeaderBinding

type HeaderBinding struct {
}

func (HeaderBinding) Bind

func (y HeaderBinding) Bind(ctx *gin.Context, val vax.Validatable) error

type JsonBinding

type JsonBinding struct {
}

func (JsonBinding) Bind

func (j JsonBinding) Bind(ctx *gin.Context, val vax.Validatable) error

type QueryBinding

type QueryBinding struct {
}

func (QueryBinding) Bind

func (q QueryBinding) Bind(ctx *gin.Context, val vax.Validatable) error

type TomlBinding

type TomlBinding struct {
}

func (TomlBinding) Bind

func (y TomlBinding) Bind(ctx *gin.Context, val vax.Validatable) error

type UriBinding

type UriBinding struct {
}

func (UriBinding) Bind

func (y UriBinding) Bind(ctx *gin.Context, val vax.Validatable) error

type XmlBinding

type XmlBinding struct {
}

func (XmlBinding) Bind

func (x XmlBinding) Bind(ctx *gin.Context, val vax.Validatable) error

type YamlBinding

type YamlBinding struct {
}

func (YamlBinding) Bind

func (y YamlBinding) Bind(ctx *gin.Context, val vax.Validatable) error

Jump to

Keyboard shortcuts

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