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 }