Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
zhupengfei 29c69b4c64 | 3 years ago | |
---|---|---|
.. | ||
test | 3 years ago | |
.gitignore | 3 years ago | |
README.md | 3 years ago | |
index.js | 3 years ago | |
package.json | 3 years ago |
项目更多介绍参照:https://github.com/yitter/idgenerator
代码贡献者:bubao 布宝
执行测试代码
node test/test2.js
const GenId = require("./index.js")
const genid = new GenId({ WorkerId: 1 });
for (let index = 0; index < 5000; index++) {
console.log(genid.NextId());
}
在mysql中int类型最大长度是10位数字,由于本算法默认生成的是15位,最短也是11位,所以在mysql中需要使用bigint数据类型
雪花算法中非常好用的数字ID生成器
C C# Pascal Go D other