# README
libtools
common golang lib tools
1. try v1.0.0
2. try v1.0.1
3. try v1.0.2
4. try v1.0.3
some functions specifications
date tools
//golang origin date functions drive me crazy
//UnixMsec2Date and Date2UnixMsec are better ones O(∩_∩)O
showTime := libtools.UnixMsec2Date(1664182378999, "Y-m-d H:i:s")
fmt.Println("showTime:", showTime)
//showTime: 2022-09-26 16:52:58
ut := libtools.Date2UnixMsec("2022-09-26 16:52:58", "Y-m-d H:i:s")
fmt.Println("ut:", ut)
//ut: 1664182378000
str,int64,int conversion
libtools.Int642Str(1664182378000)
libtools.Str2Int64("1664182378000")
libtools.AbsInt64(1)
libtools.AbsInt64(-1)
Struct2Map
libtools.Struct2Map
libtools.Map2struct
MoneyDisplay
libtools.MoneyDisplay
libtools.HumanMoney
http request
libtools.SimpleHttpClient
md5
libtools.Sha256()
libtools.Sha1()
libtools.Md5()
# Functions
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
No description provided by the author
No description provided by the author
4位字符串版本 1.1234.1234.1234.
3 位版本号 1.2.3.
将slice 转化成字符串[]int{1, 2, 3, 4, 5} => 1,2,3,4,5 或[]string{"1", "2", "3", "4", "5"} => 1,2,3,4,5"AAA bbb" 转为 AAA,bbb其他类型返回空字符串.
base64解码.
base64编码.
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
BuildFileHashName 创建本地文件的hash名.
No description provided by the author
为app端上传文件生成hash文件名.
caculateTimeZone计算时区.
No description provided by the author
Camel string, xx_yy to XxYy.
通过反射更改结构体的值.
CheckRequiredParameter 通用的检查必要参数的方法,只检测参数存在,不关心参数值.
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
*
13:23
*/.
No description provided by the author
No description provided by the author
DateParseYMDHMS 解析 YYYY-MM-DD HH:MM:SS 格式的时间串为Unix时间戳.
No description provided by the author
No description provided by the author
DecimalMoneyMul100 将带小数点的金额转换成数据库中的乘以100后的整数.
解密.
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
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
二倍均值算法,count剩余个数,amount剩余金额.
加密.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Exists 判断所给路径文件/文件夹是否存在.
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
No description provided by the author
! 手机验证在4-8位之间.
生成一个区间范围的随机数,左闭右开.
生成一个区间范围的随机数,左闭右开.
No description provided by the author
No description provided by the author
生成密钥对.
GetBetweenDates 根据开始日期和结束日期计算出时间段内所有日期 参数为日期格式,如:2020-01-01.
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
GetDateParse 用于跑批, 或者需要以 UTC时区为基准的时间解析.
GetDateParseBackend 所有后台使用.
GetDateParse 用于跑批, 或者需要以 UTC时区为基准的时间解析.
No description provided by the author
No description provided by the author
* 获取过去时中最近的5分数 */.
* 获取一天的0点0分0秒 */.
No description provided by the author
返回单位为:米.
No description provided by the author
简易版取文件名后缀,path.Ext()方法会带着个`.`.
No description provided by the author
No description provided by the author
获取传入的时间所在月份的第一天,即某月第一天的0点。如传入time.Now(), 返回当前月份的第一天0点时间。.
Guid方法.
* 获取一天的固定时间的毫秒数 h 24*/.
No description provided by the author
获取传入的时间所在月份的最后一天,即某月最后一天的0点。如传入time.Now(), 返回当前月份的最后一天0点时间。.
No description provided by the author
返回的单位是秒.
*
* @Description 获得当前月的初始和结束日期
**/.
No description provided by the author
* 获取一个月的周期时间(毫秒) */.
GetMonthsBetweenDates 返回两个日期之间的月份 (格式为 YYYY-MM).
GetMP4Duration 获取视频时长,以秒计.
*
* @Description //获得当前季度的初始和结束日期
* @return
**/.
No description provided by the author
*
* @Description 获得当前月的初始和结束日期
**/.
* 获取时间计数 */.
No description provided by the author
取当前系统时间的毫秒.
No description provided by the author
*
* @Description 获得当前周的初始和结束日期
**/.
获取某一天的0点时间.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
HttpRequest 封装的 HTTP 请求函数,带默认超时 10 秒,允许覆盖超时参数.
No description provided by the author
No description provided by the author
No description provided by the author
* 将数组默认的0,转为1 */.
InIntSlice checks given string in string slice or not.
InSlice checks given string in string slice or not.
InSliceIface checks given interface in interface slice.
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
IntsSliceToWhereInString 将状态或者IDs集合转换为string interface{}支持所有int, int8 etc.: %d.
No description provided by the author
IsDir 判断所给路径是否为文件夹.
IsFile 判断所给路径是否为文件.
IsIndonesiaName 判断是否是合法的印尼名字.
IsInMap template辅助方法 key 是否在map中.
No description provided by the author
IsInternalIPV1 超简算法.
IsNumber 判断是否都是数字.
No description provided by the author
IsStructContainsField 判断结构体是否包含给定的字段 方法有点脆弱,不能传结构体指针!!!.
IsValidIndonesiaMobile 是否是印尼的有效电话号 08 开头, 10-13位数字, 2018.08,有13位手机号段了 2018.11 增加15位手机号判断.
No description provided by the author
直接json.Marshal , 会把 < > & 转成 unicode 编码 JSONMarshal 解决直接json.Marshal 后单引号,双引号,< > & 符号的问题.
生成本地hash目录.
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
MaxInt64 求最大值.
md5方法.
No description provided by the author
格式化毫秒时间.
毫秒,输出本地时间.
毫秒,输出北京时间.
No description provided by the author
No description provided by the author
毫秒.
No description provided by the author
手机号脱敏处理(只保留前两位和后四位,中间的每个字符都替换为"*") 例如:08123456789 改为 08*****6789, 0812345645678 改为 08*******5678.
MobileFormat 去除空格,并且不能加拨0或62.
No description provided by the author
No description provided by the author
No description provided by the author
支持post原始多文件上传,同时携带表单数据.
No description provided by the author
NewECBDecrypter returns a BlockMode which decrypts in electronic code book mode, using the given Block.
NewECBEncrypter returns a BlockMode which encrypts in electronic code book mode, using the given Block.
No description provided by the author
No description provided by the author
NumberFormat 输出格式化数字,千分位以逗号分割.
No description provided by the author
ParseDateRangeToDayRange 将时间范围字符串解析成毫秒时间戳 默认日期分隔符 " - " start, end, err.
PareseDateRangeToDayRangeWithSep 将时间范围字符串解析成毫秒时间戳 start, end, err.
ParseTableName 从SQL语句中解析主表名.
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
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
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
No description provided by the author
Signature 空参数值的参数名参与签名.
No description provided by the author
No description provided by the author
SignatureV2 空参数不参与签名.
简单的http客户端,支持POST表单域,但不支持上传文件.
简单的http客户端,支持POST表单域,但不支持上传文件.
No description provided by the author
简单的http客户端,支持POST表单域,但不支持上传文件.
No description provided by the author
SliceChunk separates one slice to some sized slice.
SliceDiff returns diff slice of slice1 - slice2.
SliceFilter generates a new slice after filter function.
SliceInt64ToMap 输出格式化数字,千分位以逗号分割.
SliceIntersect returns slice that are present in all the slice1 and slice2.
SliceMerge merges interface slices to one slice.
SlicePad prepends size number of val into slice.
SliceRand returns random one from slice.
SliceRandList generate an int slice from min to max.
SliceRange generates a new slice from begin to end with step duration of int64 number.
SliceReduce generates a new slice after parsing every value by reduce function.
SliceRepeatVal 获取数组中重复的值.
SliceShuffle 数组值打乱.
SliceSum sums all values in int64 slice.
SliceUnique 去掉重复的值.
Snake string, XxYy to xx_yy , XxYY to xx_yy.
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
Str2TimeByLayout 使用layout将时间字符串转unix时间戳(毫秒).
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
StrReplace 在 origin 中搜索 search 组,替换成 replace.
No description provided by the author
Struct2Form 结构体转表单.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Struct2MapV3 结构体转map,有效防止了整型意外转科学记数法.
字串截取.
字串截取.
No description provided by the author
No description provided by the author
* 从一种时间格式转为另一种 ,或者转为时间戳
* @param timestr 即将处理的时间字符串
* @param fromFormat 当前时间格式 Mon, 02 Jan 2006 MST
* @param toFormat 目标时间格式 2006-01-02 15:04:05
* @param fromFormat 当前时间格式
* @param unixtime 为真返回时间戳,否则正常转换时间格式
* @return string []byte
*/.
ToSlice 转化 泛型为 slice.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
url base64解码.
url base64编码.
url 解码.
url 编码.
No description provided by the author
No description provided by the author
email verify.
No description provided by the author
mobile verify,国内手机号.
No description provided by the author
No description provided by the author
# Constants
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
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
No description provided by the author
No description provided by the author
RSA_ALGORITHM_SIGN = crypto.SHA256.
No description provided by the author
No description provided by the author
# Structs
BoxHeader 信息头.
No description provided by the author
No description provided by the author
# Type aliases
ContentType 类型定义.