autoinc 提供了一个简单的 ID 自增功能
ai := autoinc.New(0, 1, 1)
ctx, cancel = context.WithCancel(context.Background())
defer cancel()
go ai.Serve(ctx)
for i:=0; i<10; i++ {
fmt.Println(ai.MustID())
}
安装
go get github.com/issue9/autoinc/v2
Go 唯一 ID 自增服务
autoinc 提供了一个简单的 ID 自增功能
ai := autoinc.New(0, 1, 1)
ctx, cancel = context.WithCancel(context.Background())
defer cancel()
go ai.Serve(ctx)
for i:=0; i<10; i++ {
fmt.Println(ai.MustID())
}
go get github.com/issue9/autoinc/v2
Go 唯一 ID 自增服务
https://pkg.go.dev/github.com/issue9/autoinc/v2
MIT License