(strings: TemplateStringsArray, ...params: SQLChunk[])
| 483 | This type is used to make our lives easier and the type checker happy. |
| 484 | */ |
| 485 | export function sql(strings: TemplateStringsArray, ...params: SQLChunk[]): SQL { |
| 486 | const queryChunks: SQLChunk[] = []; |
| 487 | if (params.length > 0 || (strings.length > 0 && strings[0] !== class="st">'')) { |
| 488 | queryChunks.push(new StringChunk(strings[0]!)); |
| 489 | } |
| 490 | for (const [paramIndex, param] of params.entries()) { |
| 491 | queryChunks.push(param, new StringChunk(strings[paramIndex + 1]!)); |
| 492 | } |
| 493 | |
| 494 | return new SQL(queryChunks); |
| 495 | } |
| 496 | |
| 497 | export namespace sql { |
| 498 | export function empty(): SQL { |
no outgoing calls