sk-matrix-project/backend/golang/matrix-middle-service/pkg/utils/nanoid/nanoid.go
Shikong 998ae4a9b9 工具包调整
添加 jwt nanoid 配置 及 初始化
2023-02-26 23:48:03 +08:00

19 lines
363 B
Go

package nanoid
import (
gonanoid "github.com/matoous/go-nanoid"
"matrix-middle-service/pkg/config/nanoid"
"matrix-middle-service/pkg/logger"
)
var config *nanoid.Config
func Init(conf *nanoid.Config) {
logger.Log().Debug("[nanoid] 初始化")
config = conf
}
func GetNanoId() (string, error) {
return gonanoid.Generate(config.Sequence, config.Length)
}