import * as mssql from 'mssql'; import { SQLFunctions } from './functions'; export declare type ParamType = string | number | boolean | Date; export declare class SqlFactory { private static instance; private readonly connectionTimeout; private _pool; private timerReset; private idleTimer; get pool(): mssql.ConnectionPool; get request(): typeof mssql.Request; private constructor(); private checkConnection; functions: SQLFunctions; static getInstance(): SqlFactory; init(config: mssql.config): Promise; close: () => Promise; /** Executes query and returns the result as an array of objects */ query(sqlStr: string, ...params: Array): Promise>; /** Executes the query and returns the first record (object) or null if no records found */ queryOne(sqlStr: string, ...params: Array): Promise; /** * Executes the query and returns the first value of the first record * An error is thrown if no records found * Can be useful in cases like "SELECT COUNT (*) FROM Users" or "SELECT Name From Users WHERE id = @P1" */ queryValue(sqlStr: string, ...params: Array): Promise; /** Executes an Insert query and returns the identity of the record inserted */ insertReturnIdentity(sqlStr: string, ...params: Array): Promise; /** Alias to query */ q: (sqlStr: string, ...params: Array) => Promise>; /** Alias to queryOne */ q1: (sqlStr: string, ...params: Array) => Promise; /** Alias to queryValue */ qv: (sqlStr: string, ...params: Array) => Promise; /** Alias to insertReturnIdentity */ ii: (sqlStr: string, ...params: Array) => Promise; } export interface SqlConfig extends mssql.config { } export declare const sql: SqlFactory;