pkg

package
v0.0.0-...-5aa174a Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApiErrHandler

func ApiErrHandler(err error) (int, interface{})

func ApiErrorLog

func ApiErrorLog(name, msg string, v interface{})

ApiErrorLog 打印名为 name 的 API 产生的错误。

func ApiOKHandler

func ApiOKHandler(data interface{}) interface{}

func CopyTo

func CopyTo(source, dest interface{}, debug ...bool) (err error)

CopyTo 将source结构体内容转换为dest结构体

func Duration

func Duration(s, e time.Time) (time.Duration, error)

func JsonTo

func JsonTo(json string, dest interface{}) (err error)

JsonTo 将字符串转换为dest结构体

func JwtDecode

func JwtDecode(tokenString, secret string) (jwt.MapClaims, error)

func JwtFromUid

func JwtFromUid(secret string, expire, uid int64) (string, error)

func Md5Sum

func Md5Sum(s string) string

func RandString

func RandString(n int64) string

func Sec2MS

func Sec2MS(second int64, minuteTpl string, secondTpl string) (t string)

Sec2MS 秒数转为"分:秒"格式

func ToStr

func ToStr(dest interface{}) string

ToStr 将结构体转换为字符串

func UidFromJwt

func UidFromJwt(ctx context.Context) int64

Types

type Response

type Response struct {
	Code    int64       `json:"code"`
	Data    interface{} `json:"data"`
	Message string      `json:"message"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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