Skip to content

Draft Specification for V2

Yoshiyuki Mineo edited this page Oct 14, 2024 · 1 revision
  • Make bit assignment customizable
    • BitLenMachineID = 63 - BitLenTime - BitLenSequence
type Settings struct {
	BitLenTime     int
	BitLenSequence int
	StartTime      time.Time
	MachineID      func() (int, error)
	CheckMachineID func(int) bool	
}
  • Remove NewSonyflake
    • Use New instead
func New(st Settings) (*Sonyflake, error)
func NewSonyflake(st Settings) *Sonyflake
  • NextID returns int64 instead of uint64
func (sf *Sonyflake) NextID() (int64, error)
Clone this wiki locally