utils

package
v0.0.0-...-8c67d6e Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 29 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckFileExt

func CheckFileExt(fileHeader *multipart.FileHeader, extListString string) bool

func CheckFileSize

func CheckFileSize(file multipart.File, maxSizeString string, unit string) bool

func CompareBcrypt

func CompareBcrypt(hash, str string) bool

func CreateAndSendNotice

func CreateAndSendNotice(noticeTitle string, noticeContent string, noticeType string, noticeToUserType string, toUser []string, username string) (err error)

func CreateToken

func CreateToken(username string) (ss string)

func EncodeBcrypt

func EncodeBcrypt(str string) (hs string, err error)

func EncodeMD5

func EncodeMD5(str string) string

func EncodeRsa

func EncodeRsa(pk string, label string) (data string, err error)

func GetConfigBackend

func GetConfigBackend(configItem string) (key string)

func GetConfigFrontend

func GetConfigFrontend(configItem string) (key string)

func GetDict

func GetDict(dictCode string) (err error, dict []model.SysDict)

func GetUsername

func GetUsername(c *gin.Context) string

func GlobalModelToMap

func GlobalModelToMap(model *global.GqaModel) map[string]interface{}

func GqaI18n

func GqaI18n(c *gin.Context, key string) string

func GqaI18nWithData

func GqaI18nWithData(c *gin.Context, key string, data string) string

func HttpPost

func HttpPost(url string, data []byte, headers map[string]string) ([]byte, error)

func MergeMap

func MergeMap(mObj ...map[string]interface{}) map[string]interface{}

func SliceSortCompact

func SliceSortCompact[T cmp.Ordered](s []T) []T

SliceSortCompact 切片去重,Go语言1.21 slices包语法

func Struct2Map

func Struct2Map(obj interface{}) map[string]interface{}

func UploadFile

func UploadFile(createPath string, fileHeader *multipart.FileHeader) (filename string, err error)

func ZipFiles

func ZipFiles(filename string, files []string, oldForm, newForm string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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