lancet
lancet copied to clipboard
A comprehensive, efficient, and reusable util function library of Go.
如: `import "github.com/duke-git/lancet/v2` 便可以通过`lancet.XXX()`的方式使用到所有函数 否则,若大量使用到lancet各包中的函数时,代码中可能会出现如下情况 ``` import ( "github.com/duke-git/lancet/v2/xx1` "github.com/duke-git/lancet/v2/xx2` "github.com/duke-git/lancet/v2/xx3` ... ) ``` 这样加重了使用负担,每使用一个函数都会去查看是属于哪个子包下的函数,且容易造成和其它包的包名冲突,不得不给包名起导入别名 若在意编译了多余的不使用的子代码包(比如部分用户可能只会用到个别函数,却编译了整个包),可以2种方式都同时支持。但个人觉得微乎其微
V2版本: func AesCbcDecrypt(encrypted, key []byte) []byte { size := len(key) if size != 16 && size != 24 && size != 32 { panic("key length shoud be 16 or 24...
函数存在问题, 会将原始目录结构全部解压到每一层
1 在转化的过程会吧deciaml 类型转化成map[] 这是个灾难, 2质疑一定要把所有的成员的类型全部转化成map 么, ? 3 是否把成员的struct 类型用interface 直接返回更安全呢? 特别遇到自定义类型又没有定json tag 的类型 如果第三点是成立的那么func (f *Field) mapValue(value any) any { ``` val := pointer.ExtractPointer(value) v := reflect.ValueOf(val) var ret...
DecimalBytes : 返回十进制标准(以 1000 为基数)下的可读字节单位字符串。precision 参数指定小数点后的位数,默认为 4。 根据描述precision参数为控制小数点的位数,但某些情况下会变成科学计数法 例如 ``` // 测试6000万这个数 formatter.DecimalBytes(61812496) // 61.812MB formatter.DecimalBytes(61812496, 2) // 61.8MB formatter.DecimalBytes(61812496, 1) // 62MB formatter.DecimalBytes(61812496, 0) // 6e+01MB //再测试4亿这个数 formatter.DecimalBytes(401000000) //401MB...
Change-Id: Icec10de54a325e7684183983e206d24e75bfeb46
go1.18中新版本lancet会编译报错:type declarations inside generic functions are not currently supported slice包下的concurrent_slice中,在泛型函数内定义了结构体导致这一错误
我看了一下,好像都是同步的,有没有计划支持异步,或已有我没找到?