util

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPGet

func HTTPGet(uri string) ([]byte, error)

HTTPGet get 请求

func HTTPPost

func HTTPPost(uri string, data string) ([]byte, error)

HTTPPost post 请求

func PostFile

func PostFile(fieldname, filename, uri string) ([]byte, error)

PostFile 上传文件

func PostJSON

func PostJSON(uri string, obj interface{}) ([]byte, error)

PostJSON post json 数据请求

func PostMultipartForm

func PostMultipartForm(fields []MultipartFormField, uri string) (respBody []byte, err error)

PostMultipartForm 上传文件或其他多个字段

Types

type CommonError

type CommonError struct {
	ErrCode int64  `json:"error_code"`
	ErrMsg  string `json:"description"`
}

CommonError 抖音返回的通用错误.

type CommonErrorExtra added in v1.0.3

type CommonErrorExtra struct {
	LogID string `json:"logid"`
	Now   int64  `json:"now"`
}

CommonErrorExtra 抖音返回的错误额外信息.

type MemCache added in v1.0.3

type MemCache struct {
	// contains filtered or unexported fields
}

MemCache memory cache.

func NewMemCache added in v1.0.3

func NewMemCache() *MemCache

NewMemCache new memory cache.

func (*MemCache) Delete added in v1.0.3

func (cache *MemCache) Delete(key string) error

Delete delete key.

func (*MemCache) Get added in v1.0.3

func (cache *MemCache) Get(key string) interface{}

Get get value.

func (*MemCache) IsExist added in v1.0.3

func (cache *MemCache) IsExist(key string) bool

IsExist key is exist.

func (*MemCache) Set added in v1.0.3

func (cache *MemCache) Set(key string, val interface{}, timeout time.Duration) error

Set set value.

type MultipartFormField

type MultipartFormField struct {
	Fieldname string
	Filename  string
}

MultipartFormField 保存文件或其他字段信息

Jump to

Keyboard shortcuts

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