摘要:
引用 // 推荐一个更加强大的转换库:https://github.com/spf13/cast package main import ( "fmt" "strconv" ) func main() { // 测试 int 和 string(decimal) 互相转换的函数 // https:// 阅读全文
posted @ 2020-10-28 17:22
江湖乄夜雨
阅读(3733)
评论(0)
推荐(0)
摘要:
说明 实际业务中需要大量处理时间日期时区数据,封装好一些方法方便后面调用: package main import ( "errors" "fmt" "time" ) const ( BINano = "2006-01-02 15:04:05.000000000" BIMicro = "2006-0 阅读全文
posted @ 2020-10-28 16:42
江湖乄夜雨
阅读(639)
评论(0)
推荐(0)
摘要:
map转结构体的函数 封装的函数 // 实现map转结构体的函数 func Map2Struct(source map[string]interface{}, target interface{}) { if err := mapstructure.Decode(source, target); e 阅读全文
posted @ 2020-10-28 11:50
江湖乄夜雨
阅读(468)
评论(0)
推荐(0)
摘要:
测试项目目录 项目代码 operates.go package redisOperate import ( "errors" "github.com/garyburd/redigo/redis" "math" "time" ) type RRedis struct { redisCli *redis 阅读全文
posted @ 2020-10-28 11:46
江湖乄夜雨
阅读(1905)
评论(1)
推荐(0)
摘要:
倒序遍历切片中的元素 package t9 import ( "fmt" "testing" ) func TestRange(t *testing.T) { lst1 := []int{1, 2, 3, 4, 5} // 方法1 for index := range lst1{ curr := l 阅读全文
posted @ 2020-10-28 11:38
江湖乄夜雨
阅读(158)
评论(0)
推荐(0)
浙公网安备 33010602011771号