17 lines
257 B
Go
17 lines
257 B
Go
|
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
|
||
|
}
|