# Functions
No description provided by the author
No description provided by the author
AesDecryptCBCByKey AES解密,CBC模式 AesDecryptCBCByKey("这是加密后的文本", "这是密钥").
AesDecryptECBByKey AES解密,ECB模式 AesDecryptECBByKey("这是加密后的文本", "这是密钥").
No description provided by the author
No description provided by the author
AesEncryptCBCByKey AES加密,CBC模式,返回 base64 字符 AesEncryptCBCByKey("这是需要加密的文本", "这是密钥").
AesEncryptECBByKey AES加密,ECB模式,返回 base64 字符 AesEncryptECBByKey("这是需要加密的文本", "这是密钥").
ArrayIndexOf 返回 某个值 在数组中的索引位置,未找到返回 -1 ArrayIndexOf(["a", "b", "c"], "d").
No description provided by the author
No description provided by the author
FirstToLower 字符首字母小写 @param str string "任意字符串" @return string FirstToLower("Abc").
FirstToUpper 字符首字母大写 @param str string "任意字符串" @return string FirstToUpper("abc").
FormatPath 格式化路径 FormatPath("/x/x/xxx\xx\xx").
No description provided by the author
GetAbsolutePath 获取路径觉得路径 GetAbsolutePath("/x/x/xxx\xx\xx").
No description provided by the author
GetFileType 用文件前面几个字节来判断 fSrc: 文件字节流(就用前面几个字节).
GetFormatByTime 获取格式化时间 "2006-01-02 15:04:05" @param v time.Time "时间" GetFormatByTime(time).
GetIpFromAddr 获取当前IP.
No description provided by the author
No description provided by the author
GetLocalIPList 获取当前IP列表.
GetLock 获取一个Locker,如果不存在,则新建 obj = GetLock("user:1") obj.Lock() obj.Unlock().
GetLogger 获取logger输出对象.
GetMD5 获取MD5字符串 @param str string "需要MD5的字符串" GetMD5("这是需要MD5的文本").
GetMilliByTime 获取时间戳 到毫秒 @param v time.Time "时间" GetMilliByTime(time).
GetNanoByTime 获取时间戳 到纳秒 @param v time.Time "时间" GetNanoByTime(time).
GetNow 获取当前时间 GetNow().
GetNowFormat 获取当前格式化时间 "2006-01-02 15:04:05" GetNowFormat().
GetNowMilli 获取当前时间戳 到毫秒 GetNowMilli().
GetNowNano 获取当前时间戳 到纳秒 GetNowNano().
GetNowSecond 获取当前时间戳 到秒 GetNowSecond().
GetRootDir 获取当前程序根路径.
GetSecondByTime 获取时间戳 到秒 @param v time.Time "时间" GetSecondByTime(time).
GetStringValue 将传入的值转为字符串 @param value interface{} "任意值" @return string GetStringValue(arg).
GetTempDir 获取临时目录.
GetUUID 生成UUID GetUUID().
No description provided by the author
GzipBytes 压缩.
Int64IndexOf 返回 某个值 在数组中的索引位置,未找到返回 -1 Int64IndexOf([1,2,3], 2).
IntIndexOf 返回 某个值 在数组中的索引位置,未找到返回 -1 IntIndexOf([1,2,3], 2).
IsEmpty 是否为nil或空字符串 @param v interface{} "传入任意值" @return bool IsEmpty(arg).
IsFalse 是否为否 判断不是true、"true"、1、"1" @param v interface{} "传入任意值" @return bool IsFalse(arg).
IsNotEmpty 是否不为nil或空字符串 @param v interface{} "传入任意值" @return bool IsNotEmpty(arg).
IsNotNull 是否不为nil或空字符串 @param v interface{} "传入任意值" @return bool IsNotNull(arg).
IsNull 是否为nil @param v interface{} "传入任意值" @return bool IsNull(arg).
IsSubPath child是否是parent子路径 IsSubPath("/a/b", "/a/b/c").
IsTrue 是否为真 判断是true、"true"、1、"1" @param v interface{} "传入任意值" @return bool IsTrue(arg).
No description provided by the author
JsonToMap json 字符串 转 map对象 JsonToMap("{\"a\":1}").
JsonToObj json 字符串 转 对象 JsonToObj("{\"a\":1}", &obj).
LoadDirFilenames 加载目录下文件(文件名为相对路径) LoadDirFilenames("/x/x/xxx\xx\xx").
LoadDirFiles 加载目录下文件 读取文件内容(key为文件名为相对路径) LoadDirFiles("/x/x/xxx\xx\xx").
LoadDirInfo 加载目录信息,目录下文件目录数量大小等,可以配置加载所有子目录 LoadDirInfo("/x/x/", true).
LockByKey 根据Key进行同步锁 LockByKey("user:1").
Marshal 转换为大驼峰命名法则 首字母大写,“_” 忽略后大写 Marshal("abc_def").
MilliToTimeText 将 毫秒 转为 `xx天xx时xx分xx秒xx毫秒`.
NewCache 创建 默认 缓存.
NewCacheByOptions 创建一个 带策略的 缓存.
No description provided by the author
No description provided by the author
No description provided by the author
NewHashRing 创建 哈希环 指定 虚拟节点数量 默认使用 DefaultVirtualNodeSize.
NewHashRingNode 创建 一个 哈希环 节点.
No description provided by the author
NewIdWorker 新建一个 雪花片算法 ID生成器,传入生成器ID NewIdWorker(1).
NewLocker 创建 Mutex Locker obj = NewLocker() obj.Lock() obj.Unlock().
NewLoggerByCallerSkip 跳过的调用方数量 skip = 1 表示 输出的 文件名 行号等 为上层方法.
No description provided by the author
NewWaitGroup 创建 WaitGroup , obj = NewWaitGroup() obj.Add(1) obj.Done() obj.Wait().
NextId 新建一个ID生成器,传入生成器ID NextId() 获取一个 雪花片算法的 ID 其中 workerId 为 默认 0.
ObjToJson 对象 转 json 字符串 ObjToJson(obj).
PathExists 路径文件是否存在 PathExists("/x/x/xxx\xx\xx").
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
RandomInt 获取随机数 @param min int "最小值" @param max int "最大值" @return int "随机数" RandomInt(1, 10).
RandomInt64 获取随机数 @param min int64 "最小值" @param max int64 "最大值" @return int64 "随机数" RandomInt64(1, 10).
RandomString 获取随机字符串 @param minLen int "最小长度" @param maxLen int "最大长度" @return string RandomString(2, 20).
RandomUserName 随机姓名 @param size int "名长度" @return string RandomUserName(2).
No description provided by the author
No description provided by the author
ReadFile 读取文件内容 返回 []byte ReadFile("/x/x/xxx\xx\xx").
ReadFileString 读取文件内容 返回字符串 ReadFileString("/x/x/xxx\xx\xx").
ReadLine 逐行读取文件 ReadLine("/x/x/xxx\xx\xx").
No description provided by the author
RsaDecryptByKey RSA解密 RsaDecryptByKey("这是加密后的文本", "这是密钥").
No description provided by the author
RsaEncryptByKey RSA加密,返回 base64 字符 RsaEncryptByKey("这是需要加密的文本", "这是密钥").
No description provided by the author
No description provided by the author
StringIndexOf 返回 某个值 在数组中的索引位置,未找到返回 -1 StringIndexOf(["a", "b", "c"], "d").
No description provided by the author
StringToBytes 字符串转为 []byte StringToBytes("这是文本").
StringToFloat64 字符串转 float64 StringToFloat64("11.2").
StringToInt 字符串转 int StringToInt("11").
StringToInt64 字符串转 int64 StringToInt64("11").
StringToUint64 字符串转 uint64 StringToUint64("11").
StrPadLeft 在字符串 左侧补全 字符串 到 指定长度 input string 原字符串 padLength int 规定补齐后的字符串长度 padString string 自定义填充字符串 StrPadLeft("xx", 5, "0") 左侧补”0“达到5位长度.
StrPadRight 在字符串 右侧补全 字符串 到 指定长度 input string 原字符串 padLength int 规定补齐后的字符串长度 padString string 自定义填充字符串 StrPadRight("xx", 5, "0") 右侧补”0“达到5位长度.
SumToString 将任意数相加,为防止精度丢失,可以传入数字字符串 SumToString("4611686027042965191", 11).
TimeFormat 时间格式化 默认 "2006-01-02 15:04:05" @param v time.Time "时间" @param layout string "格式化字符串,默认使用"2006-01-02 15:04:05"" TimeFormat(time, "2006-01-02 15:04:05").
No description provided by the author
UnGzipBytes 解压.
UnlockByKey 根据Key进行解锁同步锁 UnlockByKey("user:1").
UnZip zip解压 zipFile 压缩包地址 destDir 解压保存文件夹.
ValueToFloat64 值 转 float64 ValueToFloat64("11").
ValueToInt64 值 转 int64 ValueToInt64("11").
ValueToUint64 值 转 uint64 ValueToUint64("11").
No description provided by the author
WriteFile 写入文件内容, WriteFile("/x/x/xxx\xx\xx", StringToBytes("这是文本")).
WriteFileString 写入文件内容 WriteFileString("/x/x/xxx\xx\xx", "这是文本").
Zip zip压缩 srcFile 文件路径,destZip压缩包保存路径.
# Constants
DefaultVirtualNodeSize 默认虚拟节点.
# Variables
No description provided by the author
DefaultTimeFormatLayout 默认时间格式化.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
Cache 临时缓存结构.
No description provided by the author
CacheItem 缓存项结构.
No description provided by the author
No description provided by the author
No description provided by the author
HashRing 哈希环 存放 Node.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Interfaces
No description provided by the author
# Type aliases
No description provided by the author