Negatively Proportional Model
Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

sqlmaker

1.0.0 • Public • Published

Introduction

These examples will show you how this package works.

mkInsert("t1", { age: 27, time: new Date() }, { name: "wallace" });
//=> INSERT INTO `t1`(`age`,`time`) VALUES(27,'2017-11-27 07:51:06')
mkDelete("t1", { name: "wallace", age: 26 });
//=> DELETE FROM `t1` WHERE `name`='wallace' AND `age`=26
mkDelete("t1", `WHERE name="Wallace" AND age=26`);
//=> DELETE FROM `t1` WHERE name="Wallace" AND age=26
mkUpdate("t1", { age: 27 }, { name: "wallace" });
//=> UPDATE `t1` SET `age`=27 WHERE `name`='wallace'
mkUpdate("t1", { age: 27 }, `where name="wallace"`);
//=> UPDATE `t1` SET `age`=27 where name="wallace"
mkSelect("t1", [ "name", "gender", "age" ], { gender: 1 },
          "ORDER BY age DESC LIMIT 3 OFFSET 1");
//=> SELECT `name`,`gender`,`age` FROM `t1` WHERE `gender`=1 ORDER BY age DESC LIMIT 3 OFFSET 1
mkSelect("t1", "*", "WHERE gender=1");
//=> SELECT * FROM `t1` WHERE gender=1 
mkSelect("t1", "*", { gender: 1 });
//=> SELECT * FROM `t1` WHERE `gender`=1 

Keywords

install

npm i sqlmaker

Downloadsweekly downloads

3

version

1.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability