Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/zorro-del-caribe/ship-hold-uuids

Generate random uuids when inserting a new item whose primary key is a uuid using ship-hold data access framework
https://github.com/zorro-del-caribe/ship-hold-uuids

Last synced: about 1 month ago
JSON representation

Generate random uuids when inserting a new item whose primary key is a uuid using ship-hold data access framework

Awesome Lists containing this project

README

        

# ship-hold-uuids

[![CircleCI](https://circleci.com/gh/zorro-del-caribe/ship-hold-uuids.svg?style=svg)](https://circleci.com/gh/zorro-del-caribe/ship-hold-uuids)

Generate random uuids when inserting a new item whose primary key is a uuid. (for [ship-hold](https://gihtub.com/gh/zorro-del-caribe/ship-hold) data access framework)

## install

``npm install ship-hold-uuids``

## usage

```javascript

const Users = sh.model('users',function(h){
table:'users',
columns:{
id:'uuid'
}
});

Users
.insert({name:'Laurent')
.build();

// INSERT INTO "users" ('id','name') VALUES ('some random uuid','Laurent')

options to pass to the factory

* key: the property corresponding to the primary key (default "id")
* generator: the id generator function (default [node-uuid](https://github.com/broofa/node-uuid) - v4)