binding

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MIMEJSON              = "application/json"
	MIMEMultipartPOSTForm = "multipart/form-data"
)

Variables

View Source
var (
	JSON          = jsonBinding{}
	Form          = formBinding{}
	FormMultipart = formMultipartBinding{}
)
View Source
var (

	// ErrConvertMapStringSlice can not convert to map[string][]string
	ErrConvertMapStringSlice = errors.New("can not convert to map slices of strings")

	// ErrConvertToMapString can not convert to map[string]string
	ErrConvertToMapString = errors.New("can not convert to map of strings")
)
View Source
var (
	// ErrMultiFileHeader multipart.FileHeader invalid
	ErrMultiFileHeader = errors.New("unsupported field type for multipart.FileHeader")

	// ErrMultiFileHeaderLenInvalid array for []*multipart.FileHeader len invalid
	ErrMultiFileHeaderLenInvalid = errors.New("unsupported len of array for []*multipart.FileHeader")
)
View Source
var EnableDecoderDisallowUnknownFields = false
View Source
var EnableDecoderUseNumber = false

Functions

func BytesToString added in v0.8.2

func BytesToString(b []byte) string

BytesToString converts byte slice to string without a memory allocation. For more details, see https://github.com/golang/go/issues/53003#issuecomment-1140276077.

func StringToBytes added in v0.8.2

func StringToBytes(s string) []byte

StringToBytes converts string to byte slice without a memory allocation. For more details, see https://github.com/golang/go/issues/53003#issuecomment-1140276077.

Types

type Binding

type Binding interface {
	Name() string
	Bind(*http.Request, any) error
}

func Default added in v0.8.2

func Default(method, contentType string) Binding

type SliceValidationError

type SliceValidationError []error

func (SliceValidationError) Error

func (err SliceValidationError) Error() string

type StructValidator

type StructValidator interface {
	ValidateStruct(any) error
	Engine() any
}
var Validator StructValidator = &defaultValidator{}

Jump to

Keyboard shortcuts

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