putils

package module
v0.0.0-...-bd75b91 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64Decode

func Base64Decode(data string) []byte

func Base64Encode

func Base64Encode(bytes []byte) string

BASE64

func BuildCondition

func BuildCondition(where map[string]interface{}) (whereSql string,
	values []interface{}, err error)

func BytesToInt32

func BytesToInt32(bys []byte) int32

BytesToInt32 字节与int互换--大端法

func BytesToInt32Array

func BytesToInt32Array(byteData []byte) []uint32

BytesToInt32Array bytes转为int32数组

func BytesToInt64

func BytesToInt64(bys []byte) int64

BytesToInt64 字节与int互换--大端法

func BytesToUInt16

func BytesToUInt16(bys []byte) int

字节与int互换--大端法

func ConfusionArrayKey

func ConfusionArrayKey(arrayLen int) []int

乱序一个数组的key

func DbIsNotFound

func DbIsNotFound(err error) bool

func DoZlibCompress

func DoZlibCompress(src []byte) []byte

DoZlibCompress 进行zlib压缩

func DoZlibUnCompress

func DoZlibUnCompress(compressSrc []byte) []byte

DoZlibUnCompress 进行zlib解压缩

func FormatPrivateKey

func FormatPrivateKey(privateKey string) (pKey string)

格式化普通私钥

func FormatPublicKey

func FormatPublicKey(publicKey string) (pKey string)

格式化普通公钥

func GenRandomNumber

func GenRandomNumber(start int, end int, count int) []int

GenRandomNumber 生成count个start到end之间的随机数[start,end)

func Int32ToBytes

func Int32ToBytes(n int32) []byte

Int32ToBytes 字节与int互换--大端法

func Int64ToBytes

func Int64ToBytes(n int64) []byte

Int64ToBytes 字节与int互换--大端法

func JsonMarshal

func JsonMarshal(data interface{}) []byte

func JsonUnMarshal

func JsonUnMarshal(data []byte, v interface{}) error

func LocalIp

func LocalIp() string

获取IP地址

func Md5

func Md5(content string) string

func MilliSec

func MilliSec() int64

MilliSec 毫秒时间戳

func Rand

func Rand(min int32, max int32) int32

Rand [min, max]

func RealRand

func RealRand(min, max int64) int64

[min, max)

func RedisIsNil

func RedisIsNil(err error) bool

func SameDay

func SameDay(stamp int64) bool

SameDay 是否同一天

func Sec

func Sec() int64

Sec 秒时间戳

func Seed

func Seed()

func SerializeInt32ToStr

func SerializeInt32ToStr(data []int32, sep string) string

func SerializeInt64ToStr

func SerializeInt64ToStr(data []int64, sep string) string

func SerializeIntToStr

func SerializeIntToStr(data []int, sep string) string

func StringSliceToFloat64Slice

func StringSliceToFloat64Slice(slice []string) []float64

func StringSliceToInt64Slice

func StringSliceToInt64Slice(slice []string) []int64

func StringSliceToUInt64Slice

func StringSliceToUInt64Slice(slice []string) []uint64

func StringToFloat64

func StringToFloat64(num string) float64

func StringToInt

func StringToInt(num string) (int, error)

func StringToInt32

func StringToInt32(num string) (int32, error)

func StringToInt64

func StringToInt64(num string) (int64, error)

func StringToUint64

func StringToUint64(num string) (uint64, error)

func TimeZero

func TimeZero() int64

TimeZero 获取当天0点时间戳

func UInt16ToBytes

func UInt16ToBytes(n int) []byte

字节与int互换--大端法

func UnSerializeStrToInt

func UnSerializeStrToInt(data string, sep string) []int

func UnSerializeStrToInt32

func UnSerializeStrToInt32(data string, sep string) []int32

func UnSerializeStrToInt64

func UnSerializeStrToInt64(data string, sep string) []int64

func WeekZero

func WeekZero() int64

Week 本周第一天

func Where

func Where(wheres map[string]map[string]interface{}) func(db *gorm.DB) *gorm.DB

Types

This section is empty.

Jump to

Keyboard shortcuts

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