You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 810 B

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # ❄️ idenerator-go
  2. ## 介绍
  3. 项目更多介绍参照:https://github.com/yitter/idgenerator
  4. ## Go环境
  5. 1.SDK,go1.14
  6. 2.启用 Go-Modules
  7. ```
  8. go env -w GO111MODULE=on
  9. # Next *ONLY* for China-Users:
  10. go env -w GOPROXY=https://goproxy.cn,https://goproxy.io,direct
  11. ```
  12. 3. 安装方式
  13. ```
  14. go get -u -v github.com/yitter/idgenerator-go
  15. ```
  16. ## Go代码示例
  17. ```
  18. // 定义参数
  19. var options = idgen.NewIdGeneratorOptions(1) // 构造函数输入 WorkerId
  20. // options.WorkerId = 1
  21. // options.WorkerIdBitLength = 6
  22. // options.SeqBitLength = 6
  23. // ... 以上参数一般不需要设置,系统有默认值
  24. idgen.SetIdGenerator(options)
  25. // 调用方法生成Id
  26. var id = idgen.NextId()
  27. ```
  28. ## 代码贡献者(按时间顺序)
  29. guoyahao | amuluowin | houseme

雪花算法中非常好用的数字ID生成器