Skip to content

Commit

Permalink
fix: make values optional to allow downward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
loopingz committed Jul 19, 2023
1 parent a6a97ad commit c0fec4f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/postgres/src/sqlstore.ts
Expand Up @@ -47,13 +47,23 @@ export abstract class SQLStore<T extends CoreModel, K extends SQLStoreParameters
T,
K
> {
sqlQuery(q: string, values: any[]): Promise<SQLResult<T>> {
sqlQuery(q: string, values?: any[]): Promise<SQLResult<T>> {
q = this.completeQuery(q);
return this.executeQuery(q, values);
}

abstract executeQuery(q: string, values: any[]): Promise<SQLResult<T>>;
/**
* Execute a SQL query
* @param q the query
* @param values to be added to the query
*/
abstract executeQuery(q: string, values?: any[]): Promise<SQLResult<T>>;

/**
* Add the SELECT * FROM table if the query is not a full query
* @param q query to complete
* @returns
*/
completeQuery(q: string): string {
// Should add the INNER JOIN from map
// this.parameters.map
Expand Down

0 comments on commit c0fec4f

Please sign in to comment.