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| Name | Name | Last commit date | ||
|---|---|---|---|---|