(
...args: [string, Operator, unknown] | [string]
)
| 100 | } |
| 101 | |
| 102 | const builder: ConditionBuilder<Columns> = ( |
| 103 | ...args: [string, Operator, unknown] | [string] |
| 104 | ) => { |
| 105 | if (args.length === 3) { |
| 106 | const [a, operator, b] = args; |
| 107 | |
| 108 | if (!operators.includes(operator)) |
| 109 | throw new Error(`Unsupported operator: ${operator}`); |
| 110 | |
| 111 | return { |
| 112 | type: ConditionType.Compare, |
| 113 | a: col(a), |
| 114 | b, |
| 115 | operator, |
| 116 | }; |
| 117 | } |
| 118 | |
| 119 | return { |
| 120 | type: ConditionType.Compare, |
| 121 | a: col(args[0]), |
| 122 | operator: "=", |
| 123 | b: true, |
| 124 | }; |
| 125 | }; |
| 126 | |
| 127 | builder.isNull = (a) => builder(a, "is", null); |
| 128 | builder.isNotNull = (a) => builder(a, "is not", null); |
no test coverage detected