utils

package
v0.0.0-...-ac7d4c8 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VAL   = 0x3FFFFFFF
	INDEX = 0x0000003D
)

Variables

This section is empty.

Functions

func AesDecrypt

func AesDecrypt(crypted, key []byte) ([]byte, error)

AES解密

func AesEncrypt

func AesEncrypt(origData, key []byte) ([]byte, error)

AES加密

func ArrayIn

func ArrayIn(item interface{}, datas ...interface{}) bool

包含

func ArrayNotIn

func ArrayNotIn(item interface{}, datas ...interface{}) bool

不包含

func CRC16

func CRC16(data []byte) []byte

crc校验码

func Clone

func Clone(src interface{}) interface{}

浅克隆,可以克隆任意数据类型,对指针类型子元素无法克隆 获取类型:如果类型是指针类型,需要使用Elem()获取对象实际类型 获取实际值:如果值是指针类型,需要使用Elem()获取实际数据 说白了,Elem()就是获取反射数据的实际类型和实际值

func DeepClone

func DeepClone(src interface{}) interface{}

深度克隆,可以克隆任意数据类型

func FloatFiexd

func FloatFiexd(n float64, l int) float64

浮点数取小数位数

func GetMonday

func GetMonday(t time.Time) time.Time

获取当前时间的星期一时间

func IsMobile

func IsMobile(c *gin.Context) bool

是否为移动端

func MakeSN

func MakeSN() string

16位

func MakeShortSN

func MakeShortSN(n int64) string

创建短的SN

func MakeShortURL

func MakeShortURL(longURL string) ([4]string, error)

* implementation of short url algorithm *

func Md5

func Md5(a ...interface{}) string

md5加密

func MoneyFenToString

func MoneyFenToString(f int64) string

分转换为元

func Sha1

func Sha1(a ...interface{}) string

sha1加密

func Sha256

func Sha256(a ...interface{}) string

sha1加密

func StructName

func StructName(obj interface{}) string

结构体名称

func TestSqlConnect

func TestSqlConnect(driverName string, dataSourceName string) error

测试数据库是否可以正常连接

func VariableName

func VariableName(v interface{}) string

func ZipCompress

func ZipCompress(files []*os.File, dest string) error

压缩文件 files 文件数组,可以是不同dir下的文件或者文件夹 dest 压缩文件存放地址

func ZipDeCompress

func ZipDeCompress(zipFile, dest string) error

解压

Types

type Fen

type Fen int64

将分输出成为 元

func (Fen) MarshalJSON

func (d Fen) MarshalJSON() ([]byte, error)

type Log

type Log struct {
	// contains filtered or unexported fields
}

func NewLog

func NewLog(file string) *Log

func (*Log) Save

func (this *Log) Save(args ...interface{})

func (*Log) Savef

func (this *Log) Savef(format string, args ...interface{})

type MapInt64

type MapInt64 struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewMapInt64

func NewMapInt64() *MapInt64

func (*MapInt64) Add

func (this *MapInt64) Add(key string, val int64)

func (*MapInt64) Data

func (this *MapInt64) Data() map[string]int64

func (*MapInt64) Get

func (this *MapInt64) Get(key string) int64

func (*MapInt64) Has

func (this *MapInt64) Has(key string) (int64, bool)

func (*MapInt64) Set

func (this *MapInt64) Set(key string, val int64)

Jump to

Keyboard shortcuts

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