Comments (6)
hash规则是按 uid % 8
user := &model.User{
UID: utils.GenUID(),
AppID: "aaaa",
Account: "",
Email: "",
OpenID: fmt.Sprintf("%d", utils.GenUID()),
UUID: fmt.Sprintf("%d", utils.GenUID()),
Name: "name",
Channel: "test",
Avatar: "avatar",
Password: fmt.Sprintf("%d", utils.GenUID()),
}
from idgenerator.
ID不是连续的,每毫秒的第一个ID尾号是5。
可以用ID数值里的时间戳 % 8
from idgenerator.
可以了,但是这样上线后就不能动态修改长度了,只能换另外的hash算法了
from idgenerator.
最近在用kingshard,hash规则不能定义,用id就有问题了
from idgenerator.
你可以在雪花ID基础上*10+[1,2,3,4,5]的单循环数,然后用尾数做hash。
如果你想在kingshard中,使用整个ID做hash,那要求ID连续,这个做不到。
from idgenerator.
你可以在雪花ID基础上*10+[1,2,3,4,5]的单循环数,然后用尾数做hash。
如果你想在kingshard中,使用整个ID做hash,那要求ID连续,这个做不到。
from idgenerator.
Related Issues (20)
- Go/regworkerid/regworkerid/reghelper.go 无法连接哨兵模式的redis HOT 1
- 生成的雪花ID长度不一样 HOT 3
- IIS下,多个工作进程,ID重复该如何解决 HOT 1
- 请问下新版本Nuget包地址什么 HOT 1
- 请教:SQL Server版批量生成时会出现重复ID HOT 2
- 请教:C 版本中时钟回拨时ID生成逻辑是否有误? HOT 1
- 1
- python多进程部署 HOT 1
- PHP make 报错 HOT 2
- 可以考虑出个postgresql自动生成id的函数 HOT 2
- java中workerId的数据类型short最大值是32767,要是服务集群部署,每个节点分配一个用不了多久就达到最大值了吧 HOT 3
- WorkerId error. (range:[0, 63],错误提示 HOT 1
- sql版本的不是有序的 HOT 1
- 可以从id分解出时间和workid吗? HOT 4
- BaseTime+WorkerId问题 HOT 1
- 生成的ID数字个数能修改吗? HOT 3
- 默认生成测试50000个ID为什么有重复值
- 自动注册WorkerId的功能可以提供.net的实现样例吗 HOT 1
- 看了下go的代码用的加法返回geneid可能有bug HOT 2
- 这个每秒多少个的描述是不是有问题 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from idgenerator.