Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 22x 22x 22x 22x 22x 22x | import fallback from './fallback.js' import id from './identifier.js' import type S from './sanitised.js' import type Sid from './sanitised-identifier.js' import tsql from './template.js' import whereOf from './where.js' /** @returns EXISTS query for table with WHERE clause. */ export const exists = (table: Sid | string, where: S | Record<string, unknown>): S => { const table_ = id(table) const where_ = fallback(where, whereOf) return tsql`exists (select top 1 1 from ${table_} where ${where_})` } export default exists |