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

22 lines
454 B
Go

package sonyflake
import (
"github.com/sony/sonyflake"
sf "matrix-middle-service/pkg/config/sonyflake"
"matrix-middle-service/pkg/logger"
"time"
)
var generator *sonyflake.Sonyflake
func Init(config *sf.Config) {
logger.Log().Debug("[sonyFlake] 初始化")
var s sonyflake.Settings
s.StartTime, _ = time.Parse("2006-01-02", config.StartTime)
generator = sonyflake.NewSonyflake(s)
}
func SonyFlake() *sonyflake.Sonyflake {
return generator
}