I use bookshelf and knex in my daily work stuff. I ended up rolling my own relationships code on top of bookshelf, because I have some arcane hasMany queries and bookshelf (at the time at least) only really supports straightforward joins.
Another nice thing is that you can interop es6 classes with the bookshelf.extend notation:
class Model extends bookshelf.Model {
constructor(...args) {
super(...args);
}
}
class Profile extends Model {
constructor(...args) {
super(...args);
}
}
you just have to do that funny call of super in the constructor to link together the constructor calls manually (which is, IIRC, not necessary in plain-old es6 classes).
But I do love knex in particular - chaining together query syntax in javascript means I can do some interesting tricks with creating queries, and if I can't figure out the actual knex.js syntax, I can always do a raw sql call and get help with bound variables.
(heart) bookshelf
Another nice thing is that you can interop es6 classes with the bookshelf.extend notation:
you just have to do that funny call of super in the constructor to link together the constructor calls manually (which is, IIRC, not necessary in plain-old es6 classes).
But I do love knex in particular - chaining together query syntax in javascript means I can do some interesting tricks with creating queries, and if I can't figure out the actual knex.js syntax, I can always do a raw sql call and get help with bound variables.
Also, hi Mad! It's EricE!