util

package
v0.0.0-...-17910ed Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: MulanPSL-2.0 Imports: 20 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcSum

func CalcSum(bs []byte) (_md5, _sha1, _sha256 string)

CalcSum 计算摘要

func CloseIO

func CloseIO(ctx context.Context, io io.Closer)

CloseIO 关闭流

func DoThreeTimesIfErr

func DoThreeTimesIfErr(fn func() error) error

DoThreeTimesIfErr 最多执行三次 fn,若 err 非 nil。

func Fail

func Fail(c *gin.Context, status int, msg string)

Fail 响应失败

func FailByErr

func FailByErr(c *gin.Context, err error)

FailByErr 响应失败

func GetLocalNetIP

func GetLocalNetIP() string

GetLocalNetIP 获取本地IP

func GetLocalNoLoopIP

func GetLocalNoLoopIP() string

GetLocalNoLoopIP 获取本地IP

func HTTPJsonGet

func HTTPJsonGet[T any](ctx context.Context, url string) (*T, error)

HTTPJsonGet 发送 HTTP GET 请求,并反序列化响应数据

func IsAllHanCharacters

func IsAllHanCharacters(str string) bool

IsAllHanCharacters 字符串是否是汉字

func IsAllLetterCharacters

func IsAllLetterCharacters(str string) bool

IsAllLetterCharacters 字符串是否是字母

func Success

func Success(c *gin.Context, v any)

Success 响应成功

func SuccessMsg

func SuccessMsg(c *gin.Context, v string)

SuccessMsg 响应成功

func VendFile

func VendFile(c *gin.Context, fileSize int64, fileName string, fileObj io.Reader)

VendFile 响应文件流

Types

This section is empty.

Jump to

Keyboard shortcuts

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