This repository has been archived on 2024-11-28. You can view files and clone it, but cannot push or open issues or pull requests.
Files
schisandra-cloud-album/core/idgenerator.go
2024-08-14 00:11:32 +08:00

11 lines
439 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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