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

22 lines
365 B
Go

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
}