No commit activity in last 3 years
No release in over 3 years
Sequel Model plugin that adds [0-9a-z] unique id prefixed by a custom string.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

UUID Prefix

This is a Sequel Model plugin that adds [0-9a-z] unique ID prefixed by a custom string.

The prefix isn't stored in the database. Only the Unique ID itself is.

Usage:

class Account < Sequel::Model
  plugin Sequel::Plugins::UUIDPrefix

  uuid_prefix 'a'
end

class User < Sequel::Model
  plugin Sequel::Plugins::UUIDPrefix

  uuid_prefix 'u'
end

# Find an account.
UUIDPrefix.find('a-xxxxxxxx')

# Find a user.
UUIDPrefix.find('u-xxxxxxxx')

user1.uuid_prefix # == 'u'
user1.canonical_uuid # == 'u-abcd1234'

Account['a-xxxxyyyy'] # Returns the account with UUID a-xxxxyyyy

Account.trim_uuid('a-abcd1234') # == 'abcd1234'