youtu_grpc/pkg/id_gen/sonyflake.go
2025-02-10 14:53:03 +08:00

17 lines
440 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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的函数为空使用默认值
})
}