sqlm
Modelize SQL queries with key to parameter bindings
install
$ npm install sqlm
usage
var sqlm = var User = ;
example
var sqlm = fs = pg = pg
api
Model
{ ... }
Function query
- A function called when attempting to query the database
#exec
Modelprototype { ... }
Executes a query ignoring filters or usage of a `Binding'
String sql
- SQL queryArray params
- Query ParamatersFunction done
- Callback called after querying database
#bind
Modelprototype { ... }
Creates a binding for a model and attaches as a method to instance
String name
- Binding name attached as a method toModel
instanceobject map
- key to numbered query paramaters mapstring sql
- raw parameterized sql query
#use
Modelprototype { ... }
Installs plugin for property found in binding maps
String name
- Property name to install plugin forFunction fn
- Plugin routine
#filter
Modelprototype { ... }
Applies set filters to an object
Object} o
- Object to apply filters to
Binding
{ ... }
object map
- key to numbered query paramaters mapstring sql
- raw parameterized sql queryFunction query
- A function called when attempting to query the database
#_query
_query()
interface method that must be implemented.
#query
Bindingprototype { ... }
Query with underlying query function and data bound to params
Object data
- optional Data that will be paramterized in the order in which they were defined in themap
Function fn
- Callback function passed to the_query
function
#params
Bindingprototype { ... }
Builds SQL parameters
Object data
- Data to paramertize in an array defiend by themap
license
MIT