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/models/id.go

20 lines
277 B

package models
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])
}