UNPKG

radius-read

Version:

Realtime Dashboard

39 lines (38 loc) 1.23 kB
import { Database, DbResult } from "../models/database.model"; /** * DatabaseService is responsible for managing MySQL database connections and executing queries. */ export declare class MySqlService { /** * Connection to the MySQL database, either as a single connection or a connection pool. * @date Jun 26, 2025 12:05:32 PM * @author Biswaranjan Nayak * * @private * @type {!(MySql.Connection | MySql.Pool)} */ private connection; /** * Creates an instance of DatabaseService. */ constructor(); /** * Initializes the DatabaseService with a MySQL connection or pool based on the provided configuration. * @param config */ init(config: Database): void; /** * Executes a MySQL query with the provided query string and optional parameters. * @param query * @param queryObjArray * @returns */ executeQuery<T = any>(query: string, queryObjArray?: T[]): Promise<DbResult>; /** * Parses a query string by replacing placeholders with values from the provided object. * @param query * @param queryObj * @returns */ parsQuery<T extends object>(query: string, queryObj: T): string; }