tune

package
v0.0.0-...-8f0e436 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ContentTypeJSON application/json
	ContentTypeJSON = "application/json"
	// ContentTypeXML application/xml
	ContentTypeXML = "application/xml"
	// ContentTypePlain text/plain
	ContentTypePlain = "text/plain"
	// ContentTypePostForm application/x-www-form-urlencoded
	ContentTypePostForm = "application/x-www-form-urlencoded"
	// ContentTypeMultipartPostForm multipart/form-data
	ContentTypeMultipartPostForm = "multipart/form-data"
	// ContentTypeYaml application/x-yaml
	ContentTypeYaml = "application/x-yaml"
	// ContentTypeMsgPack application/x-msgpack
	ContentTypeMsgPack = "application/x-msgpack"
	// ContentTypeProtoBuf application/x-protobuf
	ContentTypeProtoBuf = "application/x-protobuf"
)

Variables

View Source
var (
	// ErrContentType context type error
	ErrContentType = errors.New("context type error")
)
View Source
var (
	// ErrResponseObject valid error when parse object
	ErrResponseObject = errors.New("valid error when parse object")
)

Functions

func ParseForm

func ParseForm(r *http.Request) (map[string]interface{}, error)

ParseForm 解析请求参数

func ParseJSON

func ParseJSON(r *http.Request, obj interface{}) error

ParseJSON 解析请求参数

func ParseMsgPack

func ParseMsgPack(r *http.Request, obj interface{}) error

ParseMsgPack 解析请求参数

func ParseProtoBuf

func ParseProtoBuf(r *http.Request, pm proto.Message) error

ParseProtoBuf 解析请求参数

func ParseXML

func ParseXML(r *http.Request, obj interface{}) error

ParseXML 解析请求参数

func ParseYaml

func ParseYaml(r *http.Request, obj interface{}) error

ParseYaml 解析请求参数

func ValidateStruct

func ValidateStruct(obj interface{}) error

ValidateStruct 验证数据结构体与否

Types

type FormFile

type FormFile struct {
	FileName string // file name
	Data     []byte // file bytes content
}

FormFile 表单附件信息

type MultipartForm

type MultipartForm struct {
	Params map[string]interface{}
	Files  map[string][]*FormFile
}

MultipartForm MultipartForm

func ParseMultipartForm

func ParseMultipartForm(r *http.Request) (*MultipartForm, error)

ParseMultipartForm 解析请求参数

Jump to

Keyboard shortcuts

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