Snowflake v0.0.2 Snowflake.Util

The Util module helps users work with snowflake IDs.

Util module can do the following:

  • Deriving timestamp based on ID
  • Creating buckets based on days since epoch…
  • get real timestamp of any ID

Summary

Functions

When no id is provided, we generate a bucket for the current time

Get bucket value based on segments of N days

Get timestamp from computer epoch - January 1, 1970, Midnight

Get timestamp in ms from your config epoch from any snowflake ID

Functions

bucket(units, unit_type)
bucket(integer, atom) :: integer

When no id is provided, we generate a bucket for the current time

bucket(units, unit_type, id)
bucket(integer, atom, integer) :: integer

Get bucket value based on segments of N days

real_timestamp_of_id(id)
real_timestamp_of_id(integer) :: integer

Get timestamp from computer epoch - January 1, 1970, Midnight

timestamp_of_id(id)
timestamp_of_id(integer) :: integer

Get timestamp in ms from your config epoch from any snowflake ID