Documentation ¶
Overview ¶
Package snowflake provides a very simple Twitter snowflake generator and parser. https://github.com/bwmarrin/snowflake
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Epoch is set to the twitter snowflake epoch of Nov 04 2010 01:42:54 UTC in milliseconds // You may customize this to set a different epoch for your application. Epoch = int64(1288834974657) // NodeBits Number of bits to use for Node // Remember, you have a total 22 bits to share between Node/Step NodeBits uint8 = 8 // StepBits Number of bits to use for Step // Remember, you have a total 22 bits to share between Node/Step StepBits uint8 = 14 )
Functions ¶
This section is empty.
Types ¶
type ID ¶
type ID int64
An ID is a custom type used for a snowflake ID. This is used so we can attach methods onto the ID.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
A Node struct holds the basic information needed for a snowflake generator node
func (*Node) GenerateWithInt64 ¶ added in v1.0.11
GenerateWithInt64 creates and returns a unique snowflake ID
Click to show internal directories.
Click to hide internal directories.