Miss any of our Open RFC calls?Watch the recordings here! »

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);
});
 

Keywords

none

Install

npm i repository

DownloadsWeekly Downloads

31

Version

0.2.0

License

none

Last publish

Collaborators

  • avatar