sk-matrix-project/backend/golang/matrix-middle-service/pkg/utils/sonyflake/sonyflake.go

22 lines
365 B
Go
Raw Normal View History

2023-02-26 23:25:20 +08:00
package sonyflake
import (
"github.com/sony/sonyflake"
"time"
)
const DefaultSonyFlakeStartTime = "2023-01-01"
var generator *sonyflake.Sonyflake
func Init() {
var s sonyflake.Settings
s.StartTime, _ = time.Parse("2006-01-02", DefaultSonyFlakeStartTime)
generator = sonyflake.NewSonyflake(s)
}
func SonyFlake() *sonyflake.Sonyflake {
return generator
}