FlakeId v0.1.0 FlakeId View Source
Decentralized, k-ordered ID generation service.
Link to this section Summary
Functions
Checks that ID is a valid FlakeId
Converts an integer to a binary Flake
Converts a String to a binary Flake
Generates a string with Flake
Converts a binary Flake to an integer
Converts a binary Flake to a String
Link to this section Functions
Checks that ID is a valid FlakeId
Examples
iex> FlakeId.flake_id?("9n2ciuz1wdesFnrGJU")
true
iex> FlakeId.flake_id?("#cofe")
false
iex> FlakeId.flake_id?("pleroma.social")
false
Converts an integer to a binary Flake
Examples
iex> FlakeId.from_integer(28939165907792829150732718047232)
<<0, 0, 1, 109, 67, 124, 251, 125, 95, 28, 30, 59, 36, 42, 0, 0>>
Converts a String to a binary Flake
Examples
iex> FlakeId.from_string("9n2ciuz1wdesFnrGJU")
<<0, 0, 1, 109, 67, 124, 251, 125, 95, 28, 30, 59, 36, 42, 0, 0>>
Generates a string with Flake
Link to this function
to_integer(binary_flake)
View Sourceto_integer(<<_::128>>) :: non_neg_integer()
Converts a binary Flake to an integer
Examples
iex> FlakeId.to_integer(<<0, 0, 1, 109, 67, 124, 251, 125, 95, 28, 30, 59, 36, 42, 0, 0>>)
28939165907792829150732718047232
Converts a binary Flake to a String
Examples
iex> FlakeId.to_string(<<0, 0, 1, 109, 67, 124, 251, 125, 95, 28, 30, 59, 36, 42, 0, 0>>)
"9n2ciuz1wdesFnrGJU"