Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLocalIP ¶
func GetLocalIP() string
GetLocalIP gets the local ip, it will get rid of the loop back ip
func GetRandWorkerID ¶
func GetRandWorkerID() int
GetRandWorkerID gets the worker id with random number
func HashWorkerID ¶
HashWorkerID gets the worker id with input data
func SetEpoch ¶
SetEpoch sets the epoch of uid generator, remember to set it before calling NewNode() function
func SetNodeBit ¶
func SetNodeBit(nodeBits uint8)
SetNodeBits sets the node bits, remember to set it before calling NewNode() function
func SetStepBit ¶
func SetStepBit(stepBits uint8)
SetStepBits sets the step bits, remember to set it before calling NewNode() function
Types ¶
type Node ¶
func NewNodeWithDefault ¶
NewNodeWithDefault returns *Node with default node id
func NewNodeWithIP ¶
NewNodeWithIP returns *Node with ip
func (*Node) GenerateInt ¶
GenerateInt generates a unique id with int type
func (*Node) GenerateString ¶
GenerateString generates a unique id with string type
Click to show internal directories.
Click to hide internal directories.