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.
23 lines (22 loc) • 1.09 kB
TypeScript
import { SqlColumn, SqlExp, SqlExpressionPreparedStatement } from "./types";
export declare const escapeNames: (key: string) => string;
export declare const putBackticks: (value: string) => string;
export declare const putBrackets: (value: string) => string;
/**
*
* @param tableRef
* @returns [table, alias]
*/
export declare const extractTableAlias: (tableRef: string) => Array<string>;
export declare const safeApplyAlias: (subject: string, alias?: string | undefined) => string;
export declare const isNotEmptyString: (val: any) => val is string;
/**
*
* @description Will return SqlColumn object, that is interpretated as a column, not as a string. Can be used in WHERE, sqlExpression
* @example
* {where: {date: sqlCol('another_table.date')}}
* >> WHERE `date` = `another_table`.`date`
*/
export declare const sqlCol: (column: string) => SqlColumn;
export declare const sqlExp: (column: string) => SqlExp;
export declare const placeAliasInSqlExpression: (sqlExpression: SqlExpressionPreparedStatement, alias: string | null | undefined) => SqlExpressionPreparedStatement;