Documentation ¶
Index ¶
- Constants
- type ID
- type Snowflake
- func (s Snowflake) Date() time.Time
- func (s Snowflake) HexPrettyString() string
- func (s Snowflake) HexString() string
- func (s Snowflake) IsZero() bool
- func (s Snowflake) MarshalBinary() (data []byte, err error)
- func (s Snowflake) MarshalJSON() (data []byte, err error)
- func (s Snowflake) MarshalText() (text []byte, err error)
- func (s Snowflake) String() string
- func (s *Snowflake) UnmarshalBinary(text []byte) (err error)
- func (s *Snowflake) UnmarshalJSON(data []byte) (err error)
- func (s *Snowflake) UnmarshalText(text []byte) (err error)
- func (s Snowflake) Valid() bool
Constants ¶
View Source
const (
EpochDiscord uint64 = 1420070400000
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Snowflake ¶
type Snowflake uint64
Snowflake twitter snowflake design
func GetSnowflake ¶
func NewSnowflake ¶
NewID creates a new Snowflake Snowflake from a uint64.
func ParseSnowflakeString ¶
ParseSnowflakeString interprets a string with a decimal number.
Note that in contrast to ParseUint, this function assumes the given string is always valid and thus will panic rather than return an error. This should only be used on checks that can be done at compile time, unless you want to trust other modules to returns valid data.
func ParseSnowflakeUint ¶
ParseUint converts a string and given base to a Snowflake
func (Snowflake) HexPrettyString ¶
HexPrettyString converts the Snowflake into a hexadecimal string with the hex prefix 0x
func (Snowflake) IsZero ¶
IsZero since snowflake exists of several parts, including a timestamp,
I assume a valid snowflake Snowflake is never 0.
func (Snowflake) MarshalBinary ¶
MarshalBinary create a binary literal representation as a string
func (Snowflake) MarshalJSON ¶
func (Snowflake) MarshalText ¶
func (*Snowflake) UnmarshalBinary ¶
func (*Snowflake) UnmarshalJSON ¶
func (*Snowflake) UnmarshalText ¶
Click to show internal directories.
Click to hide internal directories.