utils

package
v0.0.0-...-1259710 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecrypt

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

func AesEncrypt

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

func CopyFile

func CopyFile(srcName string, dstName string) (written int64, err error)

func DifferenceSubset

func DifferenceSubset(mainSlice, subSlice []uint32) []uint32

Get the diff of two slices

func DifferenceSubsetString

func DifferenceSubsetString(mainSlice, subSlice []string) []string

func FileExist

func FileExist(filename string) bool

func FileTmpPath

func FileTmpPath(fullPath, dbPrefix string) string

func GetConversationIDBySessionType

func GetConversationIDBySessionType(sourceID string, sessionType int) string

func GetCurrentTimestampByMill

func GetCurrentTimestampByMill() int64

Get the current timestamp by Mill

func GetCurrentTimestampByNano

func GetCurrentTimestampByNano() int64

Get the current timestamp by Nano

func GetCurrentTimestampBySecond

func GetCurrentTimestampBySecond() int64

func GetErrSuperGroupTableName

func GetErrSuperGroupTableName(groupID string) string

func GetGroupIDForMinSeq

func GetGroupIDForMinSeq(groupID string) string

func GetMsgID

func GetMsgID(sendID string) string

func GetSelfFuncName

func GetSelfFuncName() string

func GetSuperGroupTableName

func GetSuperGroupTableName(groupID string) string

func GetSwitchFromOptions

func GetSwitchFromOptions(Options map[string]bool, key string) (result bool)

func GetUserIDForMinSeq

func GetUserIDForMinSeq(userID string) string

func Int32ToString

func Int32ToString(i int32) string

func Int64ToString

func Int64ToString(i int64) string

func IntToString

func IntToString(i int) string

func Intersect

func Intersect(slice1, slice2 []uint32) []uint32

Get the intersection of two slices

func IsContain

func IsContain(target string, List []string) bool

judge a string whether in the string list

func IsContainInt

func IsContainInt(target int, List []int) bool

func IsContainUInt32

func IsContainUInt32(target uint32, List []uint32) bool

func JsonDataOne

func JsonDataOne(pb proto.Message) map[string]interface{}

func JsonStringToStruct

func JsonStringToStruct(s string, args interface{}) error

The incoming parameter must be a pointer

func KMP

func KMP(rMainString string, rSubString string) (isInMainString bool)

* KMP *

func LogBegin

func LogBegin(v ...interface{})

func LogEnd

func LogEnd(v ...interface{})

func LogFReturn

func LogFReturn(v ...interface{})

func LogSReturn

func LogSReturn(v ...interface{})

func LogStart

func LogStart(v ...interface{})

func Md5

func Md5(s string) string

func OperationIDGenerator

func OperationIDGenerator() string

func PKCS5Padding

func PKCS5Padding(plaintext []byte, blockSize int) []byte

func PKCS5UnPadding

func PKCS5UnPadding(origData []byte) []byte

func ProtoToMap

func ProtoToMap(pb proto.Message, idFix bool) map[string]interface{}

func RemoveRepeatedStringInList

func RemoveRepeatedStringInList(slc []string) []string

func RunFuncName

func RunFuncName() string

func SetSwitchFromOptions

func SetSwitchFromOptions(Options map[string]bool, key string, value bool)

func StringToInt

func StringToInt(i string) int

func StringToInt64

func StringToInt64(i string) int64

func StructToJsonString

func StructToJsonString(param interface{}) string

func StructToJsonStringDefault

func StructToJsonStringDefault(param interface{}) string

func StructToMap

func StructToMap(user interface{}) map[string]interface{}

func TrimStringList

func TrimStringList(list []string) (result []string)

func UnixNanoSecondToTime

func UnixNanoSecondToTime(nanoSecond int64) time.Time

Convert nano timestamp to time.Time type

func UnixSecondToTime

func UnixSecondToTime(second int64) time.Time

func WithMessage

func WithMessage(err error, message string) error

func Wrap

func Wrap(err error, message string) error

Types

type LogInfo

type LogInfo struct {
	Info string `json:"info"`
}

Jump to

Keyboard shortcuts

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