Socket
Book a DemoInstallSign in
Socket

sql-reader-params

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sql-reader-params

Just pass params as object and return values and text for use in db client after

latest
Source
npmnpm
Version
0.1.9
Version published
Maintainers
1
Created
Source

#sql-reader-params

Just pass params as object and return values and text for use in db client after

# content of example.sql
insert into users (pwd, myFields)
values ({{pwd}}, {{myFieldsVar}})

then in code

const sqlReader = require('sql-reader-params').default;
const sqlAsParams = sqlReader('./example.sql');

const values = sqlAsParams.paramsToValues({
    pwd: 'my-hash-pwd',
    myFieldsVar: 10
})
const text = sqlAsParams.getText();

what we have after?

values -> ['my-hash-pwd', 10]
text -> 
    insert into users (pwd, myFields)
    values ($1, $2)

then you can use it values and text in your own database client

that's all folks

licence: MIT, dudiq 2019

FAQs

Package last updated on 17 May 2020

Did you know?

Socket

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