Implementation of Snowflake ID for Mojo 🔥.
- Mojo:
mojo 24.5.0 (e8aacb95)
. Should work in future versions. - Python:
3.7+
- 🌩️ Download
fireflake.mojopkg
from releases. - 🗄️ Place it in your project working directory.
- 📝 Follow the usage guideline below.
from fireflake import Fireflake
fn main() raises:
# Generate new id with default config - Twitter/X style Snowflake ID.
fireflake = Fireflake()
new_id = fireflake.generate()
print(new_id)
# Generate new id with custom config for nodes/sequence bit count.
fireflake2 = Fireflake[node_bits_count=7, sequence_bits_count=15]()
new_id = fireflake2.generate()
print(new_id)
# Generate new id with default config but provide a custom number - which
# could be hash of your data or any other meaningful number you select.
fireflake3 = Fireflake()
new_id = fireflake3.generate(1234)
print(new_id)
- HTTP framework - @saviorand/lightbug_http
- Logging - @toasty/stump
- CLI and Terminal - @toasty/prism, @toasty/mog
- Date/Time - @mojoto/morrow and @toasty/small-time