Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
dabs
Advanced tools
MySQL Query Builder
Weekly downloads
Readme
Simple SQL Query Builder.
Uses MySQL2 as DB engine.
npm install dabs
###CONNECT
const dabs = require("dabs");
const db = await dabs.connect("mysql://user:pass@host/database");
###SELECT
const u = db.table("users");
const n = db.table("data");
let q = u.select( u.name, u.mail )
.join(n, n.uid.eq(u.uid) )
.fields( n.title.as("title") )
.fields( db.fn.COUNT(n.id).as("alias_count") )
.fields( db.fn.AVG(n.field).as("alias_avg") )
.where( u.uid.equals(db._("placeholder")) )
.where( n.id.gt(10) )
.sortBy( n.id.asc(), u.uid.desc() )
.groupBy( n.id )
.having( db.$("alias_avg").gt(100) );
let result = await q.exec({ placeholder: 5 });
console.info(q.toString());
SELECT
`users`.`name`,`users`.`mail`,`data`.`title` AS title,COUNT(`data`.`id`) AS alias_count,AVG(`data`.`field`) AS alias_avg
FROM users
JOIN `data` ON (`data`.`uid` = `users`.`uid`)
WHERE (`users`.`uid` = ? AND `data`.`id` > ?)
GROUP BY `data`.`id`
HAVING (`alias_avg` > ?)
ORDER BY `data`.`id` ASC,`users`.`uid` DESC
###INSERT
u.insert()
.fields(u.name, u.email)
.exec({ name: "test", email: "test@test.com"})
.then((data) => console.log(data))
.catch((e) => console.log(e));
###UPDATE
n.update()
.fields( n.f1 )
.where( n.f1.equals(db._("placeholder")) )
.whereAny( n.f2.equals("x"), n.f3.equals("y") )
.exec({ f1: "a specific value", placeholder: "test" })
.then((data) => console.log(data))
.catch((err) => console.log(err));
###DELETE
n.delete()
.where( n.f1.equals(db._("placeholder")) )
.exec({ placeholder: "what" })
.then((data) => console.log(data))
.catch((err) => console.log(err));
FAQs
MySQL Query Builder
The npm package dabs receives a total of 0 weekly downloads. As such, dabs popularity was classified as not popular.
We found that dabs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.