github.com/go-board/x-go@v0.1.2-0.20220610024734-db1323f6cb15/xseq/seq.go (about) 1 package xseq 2 3 import ( 4 "github.com/bwmarrin/snowflake" 5 6 "github.com/go-board/x-go/types" 7 ) 8 9 var node *snowflake.Node 10 11 func NewGenerator(n int64) *snowflake.Node { 12 node, _ = snowflake.NewNode(n) 13 return node 14 } 15 16 func NextID() types.ID { 17 return types.ID(node.Generate()) 18 }