@ftchinese/sql-trim

0.0.1 • Public • Published

Tag function to trim whitespaces and turn template string into one line. This is mainly used to write fomatted sql statement.

Example

const sql = require('@ftchinese/sql-trim');

const stmt = sql`
SELECT name AS name,
    email AS email,
    mobile_phone AS mobilePhone
FROM user
WHERE id = :id
LIMIT 1`;

const [rows, ] = conn.execute(stmt, {1});

stmt will be one line of string: SELECT name AS name, email AS email, mobile_phone AS mobilePhone FROM user WHERE id = :id LIMIT 1.

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @ftchinese/sql-trim

      Weekly Downloads

      0

      Version

      0.0.1

      License

      MIT

      Unpacked Size

      2.95 kB

      Total Files

      4

      Last publish

      Collaborators

      • neefrankie
      • sunstyle
      • wangyichen