binding

package
v1.6.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	JSON          = jsonBinding{}
	XML           = xmlBinding{}
	Form          = formBinding{}
	Query         = queryBinding{}
	FormPost      = formPostBinding{}
	FormMultipart = formMultipartBinding{}
	Uri           = uriBinding{}
	ProtoBuf      = protobufBinding{}
	MsgPack       = msgpackBinding{}
	YAML          = yamlBinding{}
	Header        = headerBinding{}
)

Functions

This section is empty.

Types

type ArgsSource

type ArgsSource fasthttp.Args

func (*ArgsSource) Peek

func (form *ArgsSource) Peek(key string) ([]string, bool)

func (*ArgsSource) TrySet

func (form *ArgsSource) TrySet(value reflect.Value, field reflect.StructField, tagValue string, opt binding.SetOptions) (isSet bool, err error)

TrySet tries to set a value by request's form source (like map[string][]string)

type Binding

type Binding interface {
	Name() string
	Bind(*fasthttp.RequestCtx, interface{}) error
}

func Default

func Default(method, contentType []byte) Binding

type BindingBody

type BindingBody interface {
	Binding
	BindBody([]byte, interface{}) error
}

type CtxSource

type CtxSource fasthttp.RequestCtx

func (*CtxSource) Peek

func (form *CtxSource) Peek(key string) ([]string, bool)

func (*CtxSource) TrySet

func (form *CtxSource) TrySet(value reflect.Value, field reflect.StructField, tagValue string, opt binding.SetOptions) (isSet bool, err error)

TrySet tries to set a value by request's form source (like map[string][]string)

type HeaderSource

type HeaderSource fasthttp.RequestHeader

func (*HeaderSource) Peek

func (form *HeaderSource) Peek(key string) ([]string, bool)

func (*HeaderSource) TrySet

func (form *HeaderSource) TrySet(value reflect.Value, field reflect.StructField, tagValue string, opt binding.SetOptions) (isSet bool, err error)

TrySet tries to set a value by request's form source (like map[string][]string)

type MultipartRequest

type MultipartRequest fasthttp.Request

func (*MultipartRequest) TrySet

func (r *MultipartRequest) TrySet(value reflect.Value, field reflect.StructField, key string, opt binding.SetOptions) (isSet bool, err error)

TrySet tries to set a value by the multipart request with the binding a form file

Jump to

Keyboard shortcuts

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