Coder Social home page Coder Social logo

broothie / typeid-ruby Goto Github PK

View Code? Open in Web Editor NEW
34.0 2.0 1.0 50 KB

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

Home Page: https://github.com/jetpack-io/typeid

License: Apache License 2.0

Ruby 98.95% Shell 1.05%
typeid uuid uuidv7

typeid-ruby's Introduction

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.

typeid-ruby's People

Contributors

broothie avatar github-actions[bot] avatar v-kolesnikov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

v-kolesnikov

typeid-ruby's Issues

Rails/ActiveRecord/Postgres

Has anyone managed to get typeid-ruby and typeid-sql working with rails/activerecord/postgres?

Despite hours and hours of trying, I cannot get past this error:

PG::UndefinedFunction: ERROR:  operator is only a shell: character varying = typeid
LINE 1: ...rnal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.