Documentation ¶
Index ¶
Constants ¶
const Epoch = 1420070400000
Epoch is the discord epoch in milliseconds.
Variables ¶
var AllowUnquoted = false
Functions ¶
This section is empty.
Types ¶
type DeconstructedSnowflake ¶
type DeconstructedSnowflake struct { Time time.Time WorkerID uint8 ProcessID uint8 Sequence uint16 }
DeconstructedSnowflake contains the properties used by Discord for each snowflake ID.
type ID ¶
type ID uint64
ID represents a unique snowflake ID.
func GetEnv ¶
GetEnv returns the value of the environment variable named by the key and parses it as a snowflake. returns ID(0) if the environment variable is not set.
func LookupEnv ¶
LookupEnv returns the value of the environment variable named by the key and parses it as a snowflake. returns false if the environment variable is not set.
func MustParse ¶
MustParse parses a string into a snowflake ID and panics on error. returns ID(0) if the string is "null"
func New ¶
New creates a new snowflake ID from the provided timestamp with worker id and sequence 0.
func (ID) Deconstruct ¶
func (id ID) Deconstruct() DeconstructedSnowflake
Deconstruct returns DeconstructedID (https://discord.com/developers/docs/reference#snowflakes-snowflake-id-format-structure-left-to-right).
func (ID) MarshalJSON ¶
MarshalJSON marshals the snowflake ID into a JSON string.
func (*ID) UnmarshalJSON ¶
UnmarshalJSON unmarshals the snowflake ID from a JSON string.