You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cronsun/id.go

20 lines
278 B

package cronsun
import (
"encoding/hex"
"github.com/rogpeppe/fastuuid"
)
var generator *fastuuid.Generator
func initID() (err error) {
generator, err = fastuuid.NewGenerator()
return
}
func NextID() string {
id := generator.Next()
return hex.EncodeToString(id[:4])
}