Security News
The Dark Side of Open Source
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
universal-query
Advanced tools
Readme
An pure javascript query builder for various databases.
Currently supported:
The API is for all the query builders the same.
This is done so you can easily change the database type, and the queries work like normal.
Although keep the database limitations in mind.
All example can be used in MySQL and MongoDB only by changing the getType value. Supported values are:
Building a simple mysql select query.
var universal_query = require('universal-query');
var mysql = universal_query.getType('mysql');
var sql = mysql.select().table('foo').toQuery();
// SELECT * FROM `foo`;
A more advanced select query
var universal_query = require('universal-query');
var mysql = universal_query.getType('mysql');
var sql = mysql.select().table('foo', 'bar').where('bar.foo_bar', '=', 1).toQuery();
// SELECT * FROM `foo` AS `bar` WHERE `bar`.`foo_bar` = 1;
An insert query
var universal_query = require('universal-query');
var mysql = universal_query.getType('mysql');
var sql = mysql.insert().table('foo').set('foo', 'bar').toQuery();
// INSERT INTO `foo` (`foo`) VALUES ('bar');
An update query
var universal_query = require('universal-query');
var mysql = universal_query.getType('mysql');
var sql = mysql.update().table('foo').set('foo', 'bar').where('foo.foo_bar', '=', 1).toQuery();
// UPDATE `foo` SET `foo`='bar' WHERE `foo`.`foo_bar` = 1;
FAQs
This is a pure javascript query builder for NodeJS supporting mysql and mongo out of the box.
The npm package universal-query receives a total of 2 weekly downloads. As such, universal-query popularity was classified as not popular.
We found that universal-query 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
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.