util

package
v0.0.0-...-ad78adf Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 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 HTTPGet2

func HTTPGet2(uri, accessToken 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

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

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

type MemCache

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

MemCache memory cache.

func NewMemCache

func NewMemCache() *MemCache

NewMemCache new memory cache.

func (*MemCache) Delete

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

Delete delete key.

func (*MemCache) Get

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

Get get value.

func (*MemCache) IsExist

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

IsExist key is exist.

func (*MemCache) Set

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