Exosphere.TID (Exosphere v0.6.0)

Copy Markdown View Source

Convenience wrapper around Exosphere.ATProto.TID.

Summary

Functions

Compare two TIDs chronologically. Returns :lt, :eq, or :gt.

Generate a new TID string.

Generate a TID for a specific datetime.

Convert a TID string to a DateTime.

Validate a TID string.

Functions

compare(tid1, tid2)

@spec compare(String.t(), String.t()) :: :lt | :eq | :gt

Compare two TIDs chronologically. Returns :lt, :eq, or :gt.

generate()

@spec generate() :: String.t()

Generate a new TID string.

generate_for(dt)

@spec generate_for(DateTime.t()) :: String.t()

Generate a TID for a specific datetime.

to_datetime(tid)

@spec to_datetime(String.t()) :: {:ok, DateTime.t()} | {:error, :invalid_tid}

Convert a TID string to a DateTime.

valid?(tid)

@spec valid?(String.t()) :: boolean()

Validate a TID string.