UNPKG

@starbemtech/star-db-query-builder

Version:

A query builder to be used with mysql or postgres

27 lines (26 loc) 1.08 kB
import { Pool } from 'mysql2/promise'; import { IDatabaseClient } from './IDatabaseClient'; import { RetryOptions } from '../core/types'; /** * Creates a MySQL database client * * This function initializes a MySQL database client with the provided pool configuration * and optional retry options. It sets up monitoring for connection events and query operations. * * @param pool - The MySQL pool instance * @param retryOptions - Optional retry options for failed queries * @returns IDatabaseClient - The MySQL database client instance * * @example * const mysqlClient = createMysqlClient(pool, { retries: 3, factor: 2, minTimeout: 1000 }); * * @example * const mysqlClient = createMysqlClient(pool, { retries: 3, factor: 2, minTimeout: 1000 }); * * @example * const mysqlClient = createMysqlClient(pool, { retries: 3, factor: 2, minTimeout: 1000 }); * * @example * const mysqlClient = createMysqlClient(pool, { retries: 3, factor: 2, minTimeout: 1000 }); */ export declare const createMysqlClient: (pool: Pool, retryOptions?: RetryOptions) => IDatabaseClient;