( sql: any, table: string, where: string )
| 178 | } |
| 179 | |
| 180 | export async function executeDelete( |
| 181 | sql: any, |
| 182 | table: string, |
| 183 | where: string |
| 184 | ): Promise<{ rows: unknown[]; rowCount: number }> { |
| 185 | validateWhereClause(where) |
| 186 | |
| 187 | const sanitizedTable = sanitizeIdentifier(table) |
| 188 | const query = `DELETE FROM ${sanitizedTable} WHERE ${where} RETURNING *` |
| 189 | const result = await sql.unsafe(query, []) |
| 190 | |
| 191 | const rowCount = result.count ?? result.length ?? 0 |
| 192 | return { |
| 193 | rows: Array.isArray(result) ? result : [result], |
| 194 | rowCount, |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | export interface IntrospectionResult { |
| 199 | tables: Array<{ |
no test coverage detected