sql-named-params
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

NPM Version CI codecov Dependency Status Dev Dependency Status

SQL Named Parameters

Convert SQL named parameters to placeholders and values.

Table of Contents

Features

  • 🚀 Zero dependencies, super tiny.
  • 💪 Written in TypeScript.

Installation

npm install --save sql-named-params

Usage

import { convert } from 'sql-named-params';

const sql = 'SELECT heros WHERE lastName = :lastName AND age <= :age';
const params = {
  lastName: 'Skywalker',
  age: 30,
};
const { query, values } = convert(sql, params);

console.log(query);
// => 'SELECT heros WHERE lastName = ? AND age <= ?'

console.log(values);
// => ['Skywalker', 30]

Development

npm install
npm run build

Dependencies (0)

    Dev Dependencies (14)

    Package Sidebar

    Install

    npm i sql-named-params

    Weekly Downloads

    2

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    6.32 kB

    Total Files

    8

    Last publish

    Collaborators

    • justinlettau