(heart) bookshelf

Date: 2016-02-24 03:53 pm (UTC)
From: [personal profile] pfooti
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.

Also, hi Mad! It's EricE!
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

November 2022

S M T W T F S
  12345
6789101112
1314 1516171819
20212223242526
27282930   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 8th, 2025 06:04 am
Powered by Dreamwidth Studios