Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Ruby implementation of TypeIDs: type-safe, K-sortable, and globally unique identifiers inspired by Stripe IDs

License

Notifications You must be signed in to change notification settings

broothie/typeid-ruby

Repository files navigation

TypeID Ruby

A Ruby implementation of TypeIDs

Gem Version RubyDoc Main codecov License

TypeIDs are a modern, type-safe, globally unique identifier based on the upcoming UUIDv7 standard. They provide a ton of nice properties that make them a great choice as the primary identifiers for your data in a database, APIs, and distributed systems. Read more about TypeIDs in their spec.

This particular implementation provides a Ruby library for generating and parsing TypeIDs.

Installation

If using bundler

bundle add typeid

If not

gem install typeid

Usage

require "typeid" #=> true
id = TypeID.new("user") #=> #<TypeID user_01h46z1k2cf2av8mp4r7we4697>
id.to_s #=> user_01h46z1k2cf2av8mp4r7we4697
other_id = TypeID.from_string(id.to_s) #=> #<TypeID user_01h46z1k2cf2av8mp4r7we4697>
id == other_id #=> true

Attributions

This gem depends on uuid7 by sprql.

About

Ruby implementation of TypeIDs: type-safe, K-sortable, and globally unique identifiers inspired by Stripe IDs

Topics

Resources

License

Stars

Watchers

Forks

Packages

Contributors 3

AltStyle によって変換されたページ (->オリジナル) /