bookshelf-uuid
Automatically generate UUIDs for your models
Installation
After installing bookshelf-uuid
with npm i --save bookshelf-uuid
,
all you need to do is add it as a bookshelf plugin and enable it on your models.
let knex = developmentlet bookshelf = knex // Add the pluginbookshelf // Enable it on your modelslet User = bookshelfModel
Usage
Nothing fancy here, just keep using bookshelf as usual.
// This user is indestructiblelet user = Userconsole // 6b7a192f-6e1c-4dcb-8e57-14ab16d5fdf4
Settings
bookshelf-uuid
generates UUIDs v4 by default, but you can easily switch to
v1 UUIDs or a custom generator.
bookshelf
Testing
git clone git@github.com:estate/bookshelf-uuid.gitcd bookshelf-uuid && npm install && npm test