utils

package
v1.0.24 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: BSD-2-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FOMRAT_DATE      = "2006-01-02"
	FORMAT_DATE_TIME = "2006-01-02 15:04:05"
)
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 Date

func Date() string

当前日期

func DateTime

func DateTime() string

当前日期时间

func DeepClone

func DeepClone(src interface{}) interface{}

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

func FileExists

func FileExists(filepath string) bool

判断文件是否存在

func FloatFiexd

func FloatFiexd(n float64, l int) float64

浮点数取小数位数

func GetMonday

func GetMonday(t time.Time) time.Time

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

func MakeSN

func MakeSN() string

16位

func MakeShortSN

func MakeShortSN(n int64) string

创建短的SN

func MakeShortURL

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

url长链接转换为短链接

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 VariableName

func VariableName(v interface{}) string

变量名

func VersionToNumber

func VersionToNumber(version string) int64

版本号转换为数字 1.1.1转换后为100010001

func ZipCompress

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

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

func ZipDeCompress

func ZipDeCompress(zipFile, dest string) error

解压

Types

type MoneyFen

type MoneyFen int64

将分输出成为 元

func (MoneyFen) MarshalJSON

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

Jump to

Keyboard shortcuts

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