network/id/id.go

17 lines
257 B
Go
Raw Normal View History

2022-10-11 17:36:09 +08:00
package id
import (
"git.hpds.cc/Component/network/log"
gonanoid "github.com/matoous/go-nanoid/v2"
)
// New generate id
func New() string {
id, err := gonanoid.New()
if err != nil {
log.Errorf("generated id err=%v", err)
return ""
}
return id
}