sk-matrix-project/app/wails/pkg/utils/idutils/sonyflake.go

21 lines
368 B
Go

package app
import (
"github.com/sony/sonyflake"
"time"
)
const DefaultSonyFlakeStartTime = "2022-01-01"
var SonyFlake *sonyflake.Sonyflake
func init() {
SonyFlake = initSonyFlake()
}
func initSonyFlake() *sonyflake.Sonyflake {
var s sonyflake.Settings
s.StartTime, _ = time.Parse("2006-01-02", DefaultSonyFlakeStartTime)
return sonyflake.NewSonyflake(s)
}