utils

package
v0.0.0-...-a3795ca Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecrypt

func AesDecrypt(cryted string) string

func AesEncrypt

func AesEncrypt(orig string) string

func GenerateTree

func GenerateTree[T any](list []T, getAttr func(T) (id any, pid any)) (res []treeNode[T])

list生成树方法

func PKCS7Padding

func PKCS7Padding(ciphertext []byte, blocksize int) []byte

func PKCS7UnPadding

func PKCS7UnPadding(origData []byte) []byte

func ParseJson

func ParseJson(jsonStr string, target any) error

解析json方法

func RemoveDup

func RemoveDup[T any](arr []T) (res []T)

切片去重方法

func RemoveDupCustom

func RemoveDupCustom[T any](arr []T, getValue func(T) any) (res []T)

自定义节点切片去重方法

func ResponseFail

func ResponseFail(c *gin.Context, errNo int, message string)

失败响应

func ResponseFailDefault

func ResponseFailDefault(c *gin.Context)

默认失败响应

func ResponseSuccess

func ResponseSuccess(c *gin.Context, data any)

成功响应

func SliceIncludes

func SliceIncludes[T any](slice []T, ele T) bool

判断元素是否在切片中

func ToJson

func ToJson(data interface{}) string

转json字符串方法

func UseRedis

func UseRedis[T any](key string, getData func() (T, error), expires time.Duration) (res T, errOut error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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