Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

dirac-table-ref

1.0.2 • Public • Published

Dirac Automatic Column Reference

Automatically use a column for table references in schemas.

/**
 * groups schema
 */
 
// Dirac table schema
{
  name: 'groups'
, schema: {
    id:    { type: 'serial', primaryKey: true }
  , name:  { type: 'text' }
    // No need to specify column: 'id' in the references
  , uid:   { type: 'integer', references: { table: 'users' } }
  }
}
/**
 * Main DB module
 */
 
var dirac = require('dirac');
var tableRef = require('dirac-table-ref');
 
dirac.use(
  // Override default column used `id`
  tableRef({ column: 'uuid'  })
);

Keywords

none

install

npm i dirac-table-ref

Downloadsweekly downloads

0

version

1.0.2

license

none

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar