typed sql template string helper
npm install typed-sql-querytyped-sql-queryThis library is partial rewrote of sql-template-strings to add type support to the generate query config
This helper generates a postgres’s QueryConfig object for the given query
``bash`
npm install typed-sql-query
`ts
import { sql } from 'typed-sql-query'
interface IResult {
id: number
name: string
}
const filter = sqlWHERE id = ${1}SELECT id, name FROM table ${filter};
const query = sql
const client = await pgPool.connect()
const result = await client.query
const query2 = sqlSELECT * FROM table ORDER BY ${sql.raw('created_at')}
const conditions = [sqlid = ${1}, sqlid = ${2}]SELECT * FROM table WHERE ${sql.join(conditions, 'AND')}
const query3 = sql
``
ISC License
Copyright (c) 2016, Felix Frederick Becker (original author)
Copyright (c) 2020, Tan, Shiaw Uen