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 772 B

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839
  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. go env -w GOPROXY=https://goproxy.cn,https://goproxy.io,direct
  10. ```
  11. 3. 安装方式
  12. ```
  13. go get -u -v github.com/yitter/idgenerator-go
  14. ```
  15. ## Go代码示例
  16. ```
  17. // 定义参数
  18. var options = idgen.NewIdGeneratorOptions(1) // 构造函数输入 WorkerId
  19. // options.WorkerId = 1
  20. // options.WorkerIdBitLength = 6
  21. // options.SeqBitLength = 6
  22. // ... 以上参数一般不需要设置,系统有默认值
  23. idgen.SetIdGenerator(options)
  24. // 调用方法生成Id
  25. var id = idgen.NextId()
  26. ```
  27. ## 代码贡献者(按时间顺序)
  28. guoyahao | amuluowin | houseme

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