1 | # FoxHound
|
2 |
|
3 | The FoxHound javascript query generator, for node.js and the browser.
|
4 |
|
5 | [![Code Climate](https://codeclimate.com/github/stevenvelozo/foxhound/badges/gpa.svg)](https://codeclimate.com/github/stevenvelozo/foxhound) [![Build Status](https://travis-ci.org/stevenvelozo/foxhound.svg?branch=master)](https://travis-ci.org/stevenvelozo/foxhound) [![Dependency Status](https://david-dm.org/stevenvelozo/foxhound.svg)](https://david-dm.org/stevenvelozo/foxhound) [![devDependency Status](https://david-dm.org/stevenvelozo/foxhound/dev-status.svg)](https://david-dm.org/stevenvelozo/foxhound#info=devDependencies)
|
6 |
|
7 | ### Getting Started
|
8 |
|
9 | $ npm install foxhound --save
|
10 |
|
11 | Then...
|
12 |
|
13 | var foxhound = require('foxhound');
|
14 | var my_awesome_query = foxhound.scope('Users').cap(20).generate().query.body;
|
15 | console.log(my_awesome_query);
|
16 |
|
17 | The default query dialect is english, so, node should output:
|
18 |
|
19 | Please give me 20 of your Users. Thank you!
|
20 |
|
21 | This is not very useful for anything other than testing, so, we might want to change the dialect and try again:
|
22 |
|
23 | var foxhound = require('foxhound');
|
24 | var my_awesome_query = foxhound.scope('Users').cap(20).setDialect('MySQL').generate().query.body;
|
25 | console.log(my_awesome_query);
|
26 |
|
27 | Which now will output:
|
28 |
|
29 | SELECT * FROM Users LIMIT 20;
|
30 |
|
31 | ### Testing
|
32 |
|
33 | $ npm test
|
34 | $ npm run coverage
|