youtu_grpc/pkg/id_gen/sonyflake.go

17 lines
440 B
Go
Raw Permalink Normal View History

package id_gen
import (
"github.com/sony/sonyflake"
"time"
)
var st = time.Date(2025, 2, 8, 0, 0, 0, 0, time.UTC)
func New() (cli *sonyflake.Sonyflake) {
return sonyflake.NewSonyflake(sonyflake.Settings{
StartTime: st, //开始时间,早于当前时间,固定值
MachineID: nil, //获取MachineID的函数为空使用默认值
CheckMachineID: nil, //获取CheckMachineID的函数为空使用默认值
})
}