package nanoid

import (
	gonanoid "github.com/matoous/go-nanoid"
	"matrix-common/pkg/logger"
	"matrix-middle-service/pkg/config/nanoid"
)

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)
}
