🏗️ microservice fabric splitting

This commit is contained in:
2024-12-24 00:38:41 +08:00
parent 462e811742
commit 89d64336f5
311 changed files with 18384 additions and 2428 deletions

View File

@@ -0,0 +1,10 @@
package idgenerator
import "github.com/yitter/idgenerator-go/idgen"
func NewIDGenerator(workerId uint16) {
var options = idgen.NewIdGeneratorOptions(workerId)
options.WorkerIdBitLength = 6 // 默认值6限定 WorkerId 最大值为2^6-1即默认最多支持64个节点。
options.SeqBitLength = 6 // 默认值6限制每毫秒生成的ID个数。若生成速度超过5万个/秒,建议加大 SeqBitLength 到 10。
idgen.SetIdGenerator(options)
}