Pika (pika v0.4.0)

View Source

Summary

Functions

Deconstructs a Pika ID and returns it's metadata

Generates an ID given a prefix (which should be configured).

Functions

deconstruct(id)

Deconstructs a Pika ID and returns it's metadata:

  • prefix
  • tail
  • snowflake
  • timestamp
  • prefix_record
  • epoch
  • node_id
  • seq

gen(prefix)

@spec gen(binary()) :: {:error, binary()} | {:ok, binary()}

Generates an ID given a prefix (which should be configured).

This function will return an {:error, binary()} if one of the follow conditions are met:

  1. The prefix isn't valid
  2. The prefix isn't configured

gen!(prefix)

@spec gen!(binary()) :: binary()