bindme

package module
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEOF           = errors.New("body must not be empty")
	ErrInvalidJson   = errors.New("body contains badly-formed JSON")
	ErrDuplicateJson = errors.New("body contains only one JSON object")
	ErrNotJson       = errors.New("body content-type header is not application/json")
)

Functions

func ReadFile added in v0.4.0

func ReadFile(r *http.Request, fileName string, required bool, maxFileSize int64) (multipart.File, *multipart.FileHeader, error)

func ReadForm added in v0.3.0

func ReadForm(r *http.Request, dst interface{}) error

func ReadJson

func ReadJson(r *http.Request, dst interface{}) error

func WriteJson

func WriteJson(w http.ResponseWriter, status int, v interface{}, headers http.Header) error

Types

type Map added in v0.7.0

type Map map[string]string

type Validator added in v0.7.0

type Validator struct {
	Errors Map
}

func New added in v0.7.1

func New() *Validator

func (*Validator) Add added in v0.7.0

func (v *Validator) Add(key, value string)

func (*Validator) Check added in v0.7.0

func (v *Validator) Check(ok bool, key, value string)

func (*Validator) In added in v0.8.0

func (v *Validator) In(value string, list ...string) bool

func (*Validator) IsValid added in v0.7.0

func (v *Validator) IsValid() bool

func (*Validator) ReadCSV added in v0.7.0

func (v *Validator) ReadCSV(qs url.Values, key string, defaultValue []string) []string

func (*Validator) ReadInt added in v0.7.0

func (v *Validator) ReadInt(qs url.Values, key string, defaultValue int) int

func (*Validator) ReadString added in v0.7.0

func (v *Validator) ReadString(qs url.Values, key, defaultValue string) string

Jump to

Keyboard shortcuts

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