util

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyCtx

func CopyCtx(ctx context.Context) context.Context

CopyCtx 拷贝Context,判断如果是ginCtx则需要拷贝

func CopyGinCtx

func CopyGinCtx(ctx *gin.Context) context.Context

CopyGinCtx 复制ginCtx

func FileHash

func FileHash(reader io.Reader, tp string) string

FileHash 计算文件hash

func FormatDate

func FormatDate(date time.Time) string

FormatDate 转时间格式 yyyy-MM-dd

func FormatDateTime

func FormatDateTime(dateTime time.Time) string

FormatDateTime 转时间格式 yyyy-MM-dd HH:mm:ss

func Get

func Get(ctx context.Context, url string, queries map[string]string, result interface{}, respErr interface{}) error

Get 快速发起get请求

func GetHttpClient

func GetHttpClient(ctx context.Context) *resty.Client

GetHttpClient 获取http client 实例

func GetNanoId

func GetNanoId() string

GetNanoId 获取32位的nanoId

func GetUuid

func GetUuid() string

GetUuid 生成uuid

func GetUuidV4

func GetUuidV4() string

GetUuidV4 生成uuid v4

func GetWithHeader added in v0.5.4

func GetWithHeader(ctx context.Context, headers map[string]string, queries map[string]string, url string, result interface{}, respErr interface{}) error

GetWithHeader 快速发起get请求,带headers

func GoInPool

func GoInPool(task func()) error

func HmacSha1WithBase64 added in v0.6.5

func HmacSha1WithBase64(secret, value string) string

func HmacSha256WithHex added in v0.7.0

func HmacSha256WithHex(secret, value string) string

func InitGoPool added in v0.8.1

func InitGoPool(max int)

func MD5

func MD5(str []byte) string

func ParseDate

func ParseDate(date string) time.Time

ParseDate 转时间格式 yyyy-MM-dd

func ParseDateTime

func ParseDateTime(dateTime string) time.Time

ParseDateTime 转时间格式 yyyy-MM-dd HH:mm:ss

func Post

func Post(ctx context.Context, url string, req interface{}, result interface{}, respErr interface{}) error

Post 快速发起post请求

func PostWithHeader added in v0.5.4

func PostWithHeader(ctx context.Context, headers map[string]string, url string, req interface{}, result interface{}, respErr interface{}) error

PostWithHeader 快速发起post请求,带headers

func Sha1

func Sha1(str []byte) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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