repository

0.2.0 • Public • Published

Repository

Repository base class for Node.JS. Currently only supports MySQL.

Creating a Repository

 
var PersonRepository = Repository.extend({
  getAll: function (limit) {
    return this.query('select * from person limit ?', [ limit ]);
  },
 
  get: function (id) {
    return this.query('select * from person where id = ?', [ id ]);
  }
});
 
var mysql = require('mysql')
  , connection = mysql.createConnection(require('./settings'))
  , personRepository = new PersonRepository(connection);
 
personRepository.getAll().then(function (person) {
  console.log(person);
}, function (err) {
  console.log('getAll error', err);
});
 

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.0
    70
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.2.0
    70
  • 0.1.0
    12

Package Sidebar

Install

npm i repository

Weekly Downloads

59

Version

0.2.0

License

none

Last publish

Collaborators

  • nathan