Documentation
¶
Index ¶
- Variables
- func Bind(r *http.Request, obj any) error
- func CommonBind(s Source, obj any) error
- func CommonTag(tag string)
- func SetByMultipartFormFile(value reflect.Value, field *reflect.StructField, files []*multipart.FileHeader) (isSet bool, err error)
- func Validate(obj interface{}) error
- type Field
- type HeaderSource
- type MultipartSource
- type RequestSource
- type Source
- type Tag
- type UriSource
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultMemory int64 = 32 << 20 BodyUnmarshaller func([]byte, any) error = json.Unmarshal )
View Source
var Validator = validator.DefaultValidator
Validator is the default validator which implements the StructValidator interface. It uses https://github.com/go-playground/validator/tree/v8.18.2 under the hood.
Functions ¶
func CommonBind ¶ added in v0.16.0
func SetByMultipartFormFile ¶
func SetByMultipartFormFile(value reflect.Value, field *reflect.StructField, files []*multipart.FileHeader) (isSet bool, err error)
Types ¶
type HeaderSource ¶
func (HeaderSource) HasValue ¶ added in v0.12.1
func (hs HeaderSource) HasValue(key string) bool
func (HeaderSource) TrySet ¶
func (hs HeaderSource) TrySet(value reflect.Value, field *reflect.StructField, key string, opt mtos.SetOptions) (isSet bool, err error)
type MultipartSource ¶
func (*MultipartSource) HasValue ¶ added in v0.12.1
func (ms *MultipartSource) HasValue(key string) bool
func (*MultipartSource) TrySet ¶
func (ms *MultipartSource) TrySet(value reflect.Value, field *reflect.StructField, key string, opt mtos.SetOptions) (isSet bool, err error)
TrySet tries to set a value by the multipart request with the binding a form file
type RequestSource ¶ added in v0.16.0
func (RequestSource) BodyBind ¶ added in v0.16.0
func (s RequestSource) BodyBind(obj any) error
func (RequestSource) Form ¶ added in v0.16.0
func (s RequestSource) Form() mtos.Setter
func (RequestSource) Header ¶ added in v0.16.0
func (s RequestSource) Header() mtos.Setter
func (RequestSource) Query ¶ added in v0.16.0
func (s RequestSource) Query() mtos.Setter
func (RequestSource) Uri ¶ added in v0.16.0
func (s RequestSource) Uri() mtos.Setter
Click to show internal directories.
Click to hide internal directories.