Documentation
¶
Overview ¶
Package flake manages IDs very similar to snowflake IDs used by Twitter and others.
Index ¶
- Constants
- Variables
- func TimeAt(ms Millis) time.Time
- type Gen
- type ID
- func (v *ID) DecodeMsgpack(dec *msgpack.Decoder) error
- func (v ID) EncodeMsgpack(enc *msgpack.Encoder) error
- func (id ID) IsZero() bool
- func (id ID) MarshalJSON() ([]byte, error)
- func (id ID) MarshalText() ([]byte, error)
- func (id ID) Millis() Millis
- func (id ID) MsFirst() ID
- func (id ID) MsLast() ID
- func (id ID) Node() uint64
- func (id ID) Seq() uint64
- func (id *ID) Set(s string) (err error)
- func (id ID) String() string
- func (id ID) StringBytes(quote byte) []byte
- func (id ID) Time() time.Time
- func (id *ID) UnmarshalJSON(input []byte) error
- func (id *ID) UnmarshalText(b []byte) (err error)
- type IDish
- type Memento
- type Millis
- type Newer
Constants ¶
View Source
const EpochMs uint64 = 1577836800_000
Bubblehouse epoch starts on Jan 1, 2020 GMT
Variables ¶
View Source
var ErrInvalid = errors.New("invalid flake")
Functions ¶
Types ¶
type ID ¶
type ID uint64
ID has 40 time bits (in ms), 8 node bits, 16 sequence bits.
func ParseBytes ¶
func (ID) MarshalJSON ¶
func (ID) MarshalText ¶
func (ID) StringBytes ¶
func (*ID) UnmarshalJSON ¶
func (*ID) UnmarshalText ¶
Click to show internal directories.
Click to hide internal directories.