bind

package
v0.0.0-...-f0f63f4 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

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 contains the request bind an validator objects.

func New

func New(r IRouter) *Binder

New returns a new binder for request bind and validation.

func (*Binder) Unmarshal

func (b *Binder) Unmarshal(iface interface{}, r *http.Request) (err error)

Unmarshal will perform an unmarshal on an interface using: form or JSON.

func (*Binder) UnmarshalAndValidate

func (b *Binder) UnmarshalAndValidate(s interface{}, r *http.Request) (err error)

UnmarshalAndValidate will unmarshal and validate a struct using the validator.

func (*Binder) Validate

func (b *Binder) Validate(s interface{}) error

Validate will validate a struct using the validator.

type IRouter

type IRouter interface {
	Param(r *http.Request, param string) string
}

IRouter extracts a URL parameter value.

Jump to

Keyboard shortcuts

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