golang技巧1
1)获取7天前的时间

currentTime := time.Now()
oldTime := currentTime.AddDate(0, 0, -7)

2) go随机数

import "math/rand"
//0 <= n <= 100
rand.Intn(100)
// 种子生成
rand.Seed(2)
   for i := 0; i < 4; i++  {
      println(rand.Intn(100))
   }
// 加密应用的随机数
import "cryto/rand"
   for i := 0; i < 4; i++  {
      n, _ := rand.Int(rand.Reader, big.NewInt(100))
      println(n.Int64())
   }

3) 字符串转int iday, _ := strconv.ParseInt(preDay, 0, 64)
4) gorm文档
5)

标签: none

添加新评论