mirror of https://github.com/shunfei/cronsun
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.
20 lines
278 B
20 lines
278 B
8 years ago
|
package cronsun
|
||
8 years ago
|
|
||
|
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])
|
||
|
}
|