Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
sql-builder
Advanced tools
Readme
This is adapter based SQL query builder. This means that building queries for every DB like MySQL(included), SQLite is handled by separate adapters. It make this sql query builder highly extendable.
require('colors');
var Select = require('sql-builder').select;
// you can assign some query data on construction
var query = new Select({
group:'time',
having:['t = 1 ASC', 'b = 2 DESC']
});
// You can use chains
query
.select('u.*')
.from('users AS u');
// put array or string or object
query.where("u.name = 'john'");
// set where to be deleted later
query.select('(SELECT COUNT(*) FROM messages) AS messages)', 'selmsg');
query.select('a.avatar').join('user_attr AS a ON a.user_id = u.id');
// show 10 items per page and 5th page
query.offset(5, 10);
// we decided not to calculate messages
query.resetSelect('selmsg');
// render to string throu renderer
console.log(query.toString().bold.blue);
require('colors');
var Delete = require('sql-builder').delete;
// add parametres on cunstruction
var query1 = new Delete({from: 'users', where:["id = 10", "blocked = 0"]});
console.warn(query1.toString().bold.green);
var query2 = new Delete();
// use chanes
query2.from('users').where('id = 10');
// add key to value later can delet by key
query2.where('blocked = 1', 'c1');
// put array
query2.where(['a = 1', 'a = 2']);
// put object
query2.where({test:'my = 2'});
// reset key. If no key all where reseted
query2.resetWhere('c2');
console.warn(query2.toString().bold.blue);
require('colors');
var Insert = require('sql-builder').insert;
var query = new Insert();
query.into('user');
query.values({
id: 0,
name: 'sergey'
});
query.values({
block: 0,
password: '123'
});
query.values({
description: "this is user's \"descritption\"! \n Or ''not? \n Anyway #1 user to test simbols."
});
console.log(query.toString().bold.blue);
require('colors');
var Update = require('sql-builder').update;
var query = new Update();
query.table('user');
query.set({
'name': 'sergey'
});
query.where('id = 1').where(['block = 0', 'date > NOW()']);
console.log(query.toString().bold.blue);
FAQs
Adapter based SQL query string builder. Get total control over constructing you SQL queries. Quickly create adapter for your favorit DB (MySQL adapter included). Set where condition, and delete it later if your app changed its mind :).
The npm package sql-builder receives a total of 3 weekly downloads. As such, sql-builder popularity was classified as not popular.
We found that sql-builder 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.