Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 

README.md

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'

About

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

Resources

License

Packages

No packages published
You can’t perform that action at this time.