MCPcopy Create free account
hub / github.com/damms005/devdb-vscode / applyConditionToQuery

Function applyConditionToQuery

src/services/sql.ts:134–145  ·  view source on GitHub ↗
(query: knexlib.Knex.QueryBuilder, conditions: WhereEntry[])

Source from the content-addressed store, hash-verified

132}
133
134function applyConditionToQuery(query: knexlib.Knex.QueryBuilder, conditions: WhereEntry[]): knexlib.Knex.QueryBuilder {
135 for (const clause of conditions) {
136 if (clause.useRawCast) {
137 // Use raw to cast the column to text for the comparison
138 query = query.whereRaw(`${clause.column}::text ${clause.operator} ?`, [clause.value]);
139 } else {
140 query = query.where(clause.column, clause.operator, clause.value);
141 }
142 }
143
144 return query;
145}
146
147function getTransformedValue(targetColumn: Column, value: any, isNumericComparison: boolean) {
148 if (targetColumn.type === 'boolean') {

Callers 2

getRowsFunction · 0.85
getTotalRowsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected