Documentation
¶
Index ¶
- Constants
- Variables
- type Decomposed
- type ID
- func (id ID) Compare(other ID) int
- func (f ID) Decompose() Decomposed
- func (id ID) Equal(other ID) bool
- func (f ID) Int64() int64
- func (id ID) MarshalBinary() ([]byte, error)
- func (id ID) MarshalJSON() ([]byte, error)
- func (id ID) MarshalText() ([]byte, error)
- func (f ID) Node() int64
- func (id *ID) Scan(v interface{}) error
- func (f ID) Step() int64
- func (f ID) String() string
- func (f ID) Timestamp() int64
- func (id *ID) UnmarshalBinary(data []byte) error
- func (id *ID) UnmarshalJSON(b []byte) error
- func (id *ID) UnmarshalText(data []byte) error
- func (id ID) Value() (driver.Value, error)
- type Node
Constants ¶
View Source
const ( TimestampBits = uint8(41) NodeBits = uint8(10) StepBits = uint8(12) DatacenterBits = uint8(5) WorkerBits = uint8(5) MaxNode = int64(-1 ^ (-1 << NodeBits)) MaxStep = int64(-1 ^ (-1 << StepBits)) MaxDatacenter = int64(-1 ^ (-1 << DatacenterBits)) MaxWorker = int64(-1 ^ (-1 << WorkerBits)) NodeShift = uint8(0) StepShift = NodeBits TimestampShift = NodeBits + StepBits )
View Source
const BaseEpoch = int64(1288834974657)
TODO This is currently based on Twitters epoch
Variables ¶
View Source
var ( ErrNodeIDInvalid = errors.New("node ID must be between 0 and 1023") ErrClockBackwards = errors.New("clock moved backwards") )
Functions ¶
This section is empty.
Types ¶
type Decomposed ¶
type ID ¶
type ID uint64
func ParseString ¶
func (ID) Decompose ¶
func (f ID) Decompose() Decomposed
func (ID) MarshalBinary ¶
func (ID) MarshalJSON ¶
func (ID) MarshalText ¶
func (*ID) UnmarshalBinary ¶
func (*ID) UnmarshalJSON ¶
func (*ID) UnmarshalText ¶
Click to show internal directories.
Click to hide internal directories.
