Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var search = new SearchBuilder('Peoples');
- // older than 21
- search.where('age', 21).greaterThan();
- // all genders that are not male
- search.where('gender', 'male').notEquals();
- // find all people with j at the beggining of their name
- search.where('name', 'j').appearsFirst().orWhere();
- // Add a grouped where
- var group = search.whereGroup();
- group.where('age', '25').notEquals();
- group.where('age', '30').notEquals();
- search.submit(function(peoples) {
- // do stuff with peoples
- });
- // THE OUTPUT
- // select * from peoples where `age` > 21 and `gender` != 'male' or `name` LIKE 'j%' and (`age` != 25 and `age` != 30);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement