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

    1.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

    Install

    npm i sql-named-params

    DownloadsWeekly Downloads

    0

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    6.15 kB

    Total Files

    8

    Last publish

    Collaborators

    • justinlettau