Socket
Socket
Sign inDemoInstall

@shasharoman/sql

Package Overview
Dependencies
1
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @shasharoman/sql

sql tools


Version published
Maintainers
1
Created

Readme

Source

SQL

SQL is a simple tool for building sql statement.

Examples

insert

const sql = require('sql');

let [s, r] = sql.mysql.insert('table', {
    foo: 'foo',
    bar: 'bar'
});

// s: insert into `table`(`foo`, `bar`) values(:foo, :bar)
// r: { foo: 'foo', bar: 'bar' }

delete

const sql = require('sql')

let [s, r] = sql.mysql.delete('table', {
    foo: 'foo',
    bar: 'bar'
});

// s: delete from `table` where `foo` = :w_foo and `bar` = :w_bar 
// r: { w_foo: 'foo', w_bar: 'bar' }

update

const sql = require('sql');

let [s, r] = sql.mysql.update('table', {
    foo: 'foo'
}, {
    bar: 'bar'
});

// s: update `table` set `foo` = :s_foo where `bar` = :w_bar
// r: { s_foo: 'foo', w_bar: 'bar' }

select

const sql = require('sql');

let [s, r] = sql.mysql.select('table', {
    foo: 'foo',
    bar: 'bar',
    limit: [0, 10],
    order: ['id', 'desc']
});

// s: select * from `table` where `foo` = :w_foo and `bar` = :w_bar order by `id` desc limit 0, 10
// r: { w_foo: 'foo', w_bar: 'bar' }

Keywords

FAQs

Last updated on 11 Aug 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc