snowflake

package
v0.0.0-...-54d5358 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package snowflake provides a Mastodon compatible Snowflake ID generator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID uint64

ID is a Mastodon compatible Snowflake ID. TODO use ID type instead of uint64 in the codebase.

func Now

func Now() ID

Now returns the current time as a Snowflake ID.

func Parse

func Parse(s string) (ID, error)

func TimeToID

func TimeToID(ts time.Time) ID

TimeToID converts a time.Time to a Snowflake ID.

func (ID) ToTime

func (id ID) ToTime() time.Time

ToTime converts a Snowflake ID to a time.Time.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL