Documentation ¶
Index ¶
- func NewCode(id uint64, options ...func(*CodeOptions)) string
- func WithCodeChars(arr []rune) func(*CodeOptions)
- func WithCodeL(l int) func(*CodeOptions)
- func WithCodeN1(n int) func(*CodeOptions)
- func WithCodeN2(n int) func(*CodeOptions)
- func WithCodeSalt(salt uint64) func(*CodeOptions)
- func WithSonyflakeMachineId(id uint16) func(*SonyflakeOptions)
- func WithSonyflakeStartTime(startTime time.Time) func(*SonyflakeOptions)
- type CodeOptions
- type Sonyflake
- type SonyflakeOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCode ¶
func NewCode(id uint64, options ...func(*CodeOptions)) string
NewCode can get a unique code by id(You need to ensure that id is unique).
func WithCodeChars ¶
func WithCodeChars(arr []rune) func(*CodeOptions)
func WithCodeL ¶
func WithCodeL(l int) func(*CodeOptions)
func WithCodeN1 ¶
func WithCodeN1(n int) func(*CodeOptions)
func WithCodeN2 ¶
func WithCodeN2(n int) func(*CodeOptions)
func WithCodeSalt ¶
func WithCodeSalt(salt uint64) func(*CodeOptions)
func WithSonyflakeMachineId ¶
func WithSonyflakeMachineId(id uint16) func(*SonyflakeOptions)
func WithSonyflakeStartTime ¶
func WithSonyflakeStartTime(startTime time.Time) func(*SonyflakeOptions)
Types ¶
type CodeOptions ¶
type CodeOptions struct {
// contains filtered or unexported fields
}
type Sonyflake ¶
type Sonyflake struct { Error error // contains filtered or unexported fields }
func NewSonyflake ¶
func NewSonyflake(options ...func(*SonyflakeOptions)) *Sonyflake
NewSonyflake can get a unique code by id(You need to ensure that id is unique).
type SonyflakeOptions ¶
type SonyflakeOptions struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.