Documentation ¶
Index ¶
- Constants
- func BytesToStruct(b *[]byte) unsafe.Pointer
- func CompressByteWithZip(dataName string, data []byte) ([]byte, error)
- func CreateSysTmpFile(fileName string, data []byte) (string, error)
- func EncryptionStrWithSha256(str string) string
- func FindDirFileWithFileName(dirPath string, fileName string) (string, error)
- func Float32ToString(f float32, prec int) string
- func Float64ToString(f float64, prec int) string
- func GetCurTimeFormatSeries() string
- func GetCurTimeFormatStandard() string
- func GetFileMd5(file multipart.File) (string, error)
- func GetFileMd5WithPath(filePath string) (string, error)
- func GetFileNameExt(fileName string) string
- func GetFileNameOnly(fileName string) string
- func GetFuncName(callFunc interface{}) string
- func GetIPFromAddr(addr string) string
- func GetMillisecondTimeInt64() int64
- func GetPortFromAddr(addr string) string
- func GetPortIntFromAddr(addr string) int
- func GetPrivateIP() string
- func GetPublicIP() string
- func GetRandChinese(min int, max int) string
- func GetRandInt(low int, high int) (int, error)
- func GetRandString(n int) string
- func GetStrWidth(str string) int
- func Int32ToString(i int32) string
- func Int64ToString(i int64) string
- func IntSliceToString(i []int, symbol string) string
- func IntToString(i int) string
- func IsDirExist(dirPath string) (bool, error)
- func IsFileExist(filePath string) bool
- func MakeDir(dirPath string) error
- func MakeDirIfNoExist(dirPath string) (bool, error)
- func MsTimeUnixTo(timeUnix int64) string
- func ReadByteWithSize(data []byte, size uint64, call func([]byte) error) error
- func ReadFileWithSize(fileName string, size uint64, call func([]byte) error) error
- func ReadIOWithSize(reader io.Reader, size uint64, call func([]byte) error) error
- func ReverseSlice[T any](slice []T) []T
- func RunesToBytes(data []byte) []byte
- func SliceToInterfaceSlice(data interface{}) []interface{}
- func StringToInt64(s string) int64
- func StringToIntSlice(s string, symbol string) []int
- func StructToBytes(ptr unsafe.Pointer, len uintptr) *[]byte
- func StructToMap(st interface{}) map[string]interface{}
- func SubStrWithCount(str string, sep string, cnt int) (string, error)
- func TimeMsUnixToTime(timeUnix int64) time.Time
- func TimeStringToMsTimeInt64(time time.Time) int64
- func TimeUnixToFormat(timeUnix int64) string
- func TimeUnixToTime(timeUnix int64) time.Time
- func Uint64ToString(i uint64) string
- type ConnManage
- func (connManage *ConnManage) AddConnList(id interface{})
- func (connManage *ConnManage) DelConnList(id interface{})
- func (connManage *ConnManage) Delete(id interface{})
- func (connManage *ConnManage) GetLen() int
- func (connManage *ConnManage) IsExist(id interface{}) bool
- func (connManage *ConnManage) IsExistDelayCheck(id interface{}, interval time.Duration, repeatNum int) bool
- func (connManage *ConnManage) Load(id interface{}) (interface{}, bool)
- func (connManage *ConnManage) LoadAll(f func(key, value interface{}) bool)
- func (connManage *ConnManage) Polling() (interface{}, bool)
- func (connManage *ConnManage) Rand() (interface{}, bool)
- func (connManage *ConnManage) Store(id interface{}, conn interface{})
Constants ¶
const TimeFormat = "2006-01-02 15:04:05"
const TimeFormatSeries = "20060102150405"
const TimeFormatUTC = "2006-01-02T15:04:05.000Z"
Variables ¶
This section is empty.
Functions ¶
func CreateSysTmpFile ¶
CreateSysTmpFile 创建系统临时文件
func EncryptionStrWithSha256 ¶ added in v0.1.7
EncryptionStrWithSha256 使用Sha256算法加密字符串
func FindDirFileWithFileName ¶ added in v0.1.7
按文件名查找指定目录下的一个文件 (与后缀无关)
func Float32ToString ¶ added in v0.1.7
float32 to string
func Float64ToString ¶ added in v0.1.7
float64 to string
func GetCurTimeFormatSeries ¶ added in v0.1.7
func GetCurTimeFormatSeries() string
GetCurTimeFormatSeries 获取标准时间连续格式字符串 20060102150405
func GetCurTimeFormatStandard ¶
func GetCurTimeFormatStandard() string
GetCurTimeFormatStandard 获取标准时间格式字符串 2006-01-02 15:04:05
func GetFileMd5 ¶ added in v0.1.7
GetFileMd5 获取文件Md5值(file)
func GetFileMd5WithPath ¶ added in v0.1.7
GetFileMd5WithPath 获取文件Md5值(path)
func GetFuncName ¶
func GetFuncName(callFunc interface{}) string
func GetIPFromAddr ¶
func GetMillisecondTimeInt64 ¶ added in v0.1.7
func GetMillisecondTimeInt64() int64
GetMillisecondTimeInt64 获取当前时间戳 (毫秒)
func GetPortFromAddr ¶
func GetPortIntFromAddr ¶
func GetStrWidth ¶ added in v0.1.7
GetStrWidth 获取字符串占用的宽度 例如: GetStrWidth("abcde"); 返回 5 例如: GetStrWidth("啊啊啊啊啊"); 返回 10 例如: GetStrWidth("123啊啊"); 返回 7 例如: GetStrWidth("abc哈哈123"); 返回 10
func MakeDirIfNoExist ¶ added in v0.1.7
MakeDirIfNoExist 判断文件夹是否存在, 不存在则创建
func MsTimeUnixTo ¶ added in v0.1.7
MsTimeUnixTo 时间戳转倒计时 (毫秒) 秒, 分钟, 小时, 天
func ReadByteWithSize ¶
func ReadFileWithSize ¶
ReadFileWithSize 按字节读取文件
func ReadIOWithSize ¶
func SliceToInterfaceSlice ¶
func SliceToInterfaceSlice(data interface{}) []interface{}
any slice to interface slice
func StringToIntSlice ¶
string to []int %u7248%u6743%u6240%u6709 %u4E8C%u96F6%u4E8C%u4E8C %u674E%u6613%u529B%u521A
func SubStrWithCount ¶ added in v0.1.7
SubStrWithCount 按计数逆序获取子字符串 例如: LastSubStrWithCount("/AA/BB/CC/DD/EE", "/", 2) 返回: "/DD/EE"
func TimeMsUnixToTime ¶ added in v0.1.7
TimeMsUnixToTime 时间戳转time.Time (豪秒)
func TimeStringToMsTimeInt64 ¶
TimeStringToMsTimeInt64 时间转时间戳 (毫秒)
func TimeUnixToFormat ¶
TimeUnixToFormat 时间戳转时间字符串 2006-01-02 15:04:05
func TimeUnixToTime ¶ added in v0.1.7
TimeUnixToTime 时间戳转time.Time (秒)
Types ¶
type ConnManage ¶
type ConnManage struct {
// contains filtered or unexported fields
}
func (*ConnManage) AddConnList ¶
func (connManage *ConnManage) AddConnList(id interface{})
func (*ConnManage) DelConnList ¶
func (connManage *ConnManage) DelConnList(id interface{})
func (*ConnManage) Delete ¶
func (connManage *ConnManage) Delete(id interface{})
func (*ConnManage) GetLen ¶
func (connManage *ConnManage) GetLen() int
func (*ConnManage) IsExist ¶
func (connManage *ConnManage) IsExist(id interface{}) bool
func (*ConnManage) IsExistDelayCheck ¶
func (connManage *ConnManage) IsExistDelayCheck(id interface{}, interval time.Duration, repeatNum int) bool
func (*ConnManage) Load ¶
func (connManage *ConnManage) Load(id interface{}) (interface{}, bool)
func (*ConnManage) LoadAll ¶
func (connManage *ConnManage) LoadAll(f func(key, value interface{}) bool)
func (*ConnManage) Polling ¶
func (connManage *ConnManage) Polling() (interface{}, bool)
func (*ConnManage) Rand ¶
func (connManage *ConnManage) Rand() (interface{}, bool)
func (*ConnManage) Store ¶
func (connManage *ConnManage) Store(id interface{}, conn interface{})