title: Knex Query build - build chain dynamically
body: <p>I've traded node-DBI for knex because it has more function that I require.</p>
  
  <p>So far I'd make the same choice again but only one thing is holding me back: writing abstract methods that take a options variable where params like where, innerjoin and such are contained in.</p>
  
  <p>Using node-dbi I could easily forge a string using these variables but I can't seem to create the knex chain dymanicly because after using a switch, you'd get knex.method is not a function.</p>
  
  <p>Any idea how to resolve this?</p>
  
  <p>I'm looking for something as in </p>
  
  <pre><code>`getData(table,options){
   var knex=knex
     if(options.select)
     /** append the select data using knex.select()
     if(options.where)
     /** append the where data using knex.where(data)*/
     if(options.innerJoin)
     /** append innerjoin data*/
  }`
  </code></pre>
  
  <p>This way I can avoid having to write alot of DB functions and let my Business Logical Layers handel the requests</p>