Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidWorkerId error = errors.New("Invalid worker ID - worker ID out of range") ErrOverflow error = errors.New("Timestamp overflow (past end of lifespan) - unable to generate any more IDs") ErrSequenceOverflow error = errors.New("Sequence overflow (too many IDs generated) - unable to generate IDs for 1 millisecond") )
Functions ¶
Types ¶
type Bigflake ¶
func New ¶
New initialises a Bigflake minter, with a default configuration This can be configured using Options
func (*Bigflake) Mint ¶
func (bf *Bigflake) Mint() (*BigflakeId, error)
Mint a new 128bit ID based on the current time, worker id and sequence
type BigflakeId ¶
type BigflakeId struct {
// contains filtered or unexported fields
}
BigflakeId represents a globally unique ID
func (*BigflakeId) Base62 ¶
func (bf *BigflakeId) Base62() string
Base62 returns a base62 encoded version
func (*BigflakeId) Base62WithPadding ¶
func (bf *BigflakeId) Base62WithPadding(minlen int) string
Base62WithPadding returns a base62 encoded id with left padding
func (*BigflakeId) BinaryString ¶
func (bf *BigflakeId) BinaryString() string
BinaryString returns a padded 128bit binary number formatted as a string
func (*BigflakeId) String ¶
func (bf *BigflakeId) String() string
String returns the raw id as a string
func (*BigflakeId) Uuid ¶
func (bf *BigflakeId) Uuid() string
Uuid returns the id encoded in UUID format
Click to show internal directories.
Click to hide internal directories.