UNPKG

mysql-all-in-one

Version:

A package that allows you to have a complete interaction with a MYSQL database, allowing to connect to the database, retrieve data and create queries.

9 lines (8 loc) 707 B
import { SqlColumn, SqlValues } from "./types"; /** * * @description Tagged template literal function to create sql expressions, will automatically escape interpolated variables to valid sql values or if will escape column names if combined with `sqlCol` function, or to complete ignore a string use `sqlExp` function; * @example sqlExpression`STR_TO_DATE(${sqlCol('date')}, "%d/%m/%Y") = ${new Date(2020, 8, 30)} AND ${sqlCol('date') > ${sqlCol('another_table.date')` * >> 'STR_TO_DATE(date, "%d/%m/%Y") = "2020-8-30" AND date > ' */ export declare const sqlExpression: ([firstStr, ...rest]: TemplateStringsArray, ...values: Array<SqlValues | SqlColumn | Record<string, any>>) => Record<string, any>;