fixed all libs to be buildiable and dependency hell from removing some
This commit is contained in:
parent
5c64b1ccf8
commit
a282dac6cd
40 changed files with 4050 additions and 8219 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { Pool, PoolClient, QueryResult as PgQueryResult } from 'pg';
|
||||
import { Pool, PoolClient, QueryResult as PgQueryResult, QueryResultRow } from 'pg';
|
||||
import { postgresConfig } from '@stock-bot/config';
|
||||
import { Logger } from '@stock-bot/logger';
|
||||
import type {
|
||||
|
|
@ -115,7 +115,7 @@ export class PostgreSQLClient {
|
|||
/**
|
||||
* Execute a query
|
||||
*/
|
||||
async query<T = any>(text: string, params?: any[]): Promise<QueryResult<T>> {
|
||||
async query<T extends QueryResultRow = any>(text: string, params?: any[]): Promise<QueryResult<T>> {
|
||||
if (!this.pool) {
|
||||
throw new Error('PostgreSQL client not connected');
|
||||
}
|
||||
|
|
@ -191,7 +191,7 @@ export class PostgreSQLClient {
|
|||
/**
|
||||
* Execute a stored procedure or function
|
||||
*/
|
||||
async callFunction<T = any>(functionName: string, params?: any[]): Promise<QueryResult<T>> {
|
||||
async callFunction<T extends QueryResultRow = any>(functionName: string, params?: any[]): Promise<QueryResult<T>> {
|
||||
const placeholders = params ? params.map((_, i) => `$${i + 1}`).join(', ') : '';
|
||||
const query = `SELECT * FROM ${functionName}(${placeholders})`;
|
||||
return await this.query<T>(query, params);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue