Go
初学者
SnakeJ3
这个作者很懒,什么都没留下…
展开
-
redisgo 简单使用
连接池操作 import ( "fmt" redis "redisgo/redis" ) func redisConnPool() *redis.Pool { setdb := redis.DialDatabase(0) // db num var pool *redis.Pool pool = &redis.Pool{ Dial: func() (redis.Conn, erro原创 2021-06-17 16:44:52 · 516 阅读 · 0 评论 -
time模块
import "time" // 获取当前时间 now := time.Now() now.Format("2006-01-02 15:04:05") // 6 1 2 3 4 5 2020-12-02 14:33:01 // 前一天 now.AddDate(0,0,-1).Format("2006-01-02") // 当前日期-1天 now.AddDate(0,0,1).Format("2006-01-02") // 当前日期+1天 // 获取某一天 day1 := time.Date(202原创 2021-06-17 15:42:07 · 52 阅读 · 0 评论 -
go json
简单使用 字符串转map import ( "fmt" "encoding/json" ) func jsonGO() { var text string var tojson map[string]interface{} // 定义类型 text = `{"status":1,"name":"test"}` // 模拟数据 json.Unmarshal([]byte(text), &tojson) fmt.Println(tojson原创 2021-06-17 15:36:21 · 45 阅读 · 0 评论