Skip to content

cs0604/snowflake_helper

Repository files navigation

snowflake_helper

借助etcd自动生成snowflake算法需要的workerId

  1. 可以直接使用当前工程的 snowflake算法,比如:
node, _ := InitSnowFlake(&clientv3.Config{
                        Endpoints:   []string{"127.0.0.1:2379"},
                        DialTimeout: dialTimeout,  
                        }, "testservice")
  1. 或者只用生成的workerID:
 workerID,err:=GenerateSnowFlakeWorkerID(&clientv3.Config{
                                  Endpoints:   []string{"127.0.0.1:2379"},
                                  DialTimeout: dialTimeout,  
                               }, "testservice")`

About

借助etcd自动生成snowflake算法需要的workerId

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages