@@ -121,6 +121,23 @@ export function not(value: ExpressionLike): BasicExpression<boolean> {
121
121
return new Func ( `not` , [ toExpression ( value ) ] )
122
122
}
123
123
124
+ // Null/undefined checking functions
125
+ export function isUndefined ( value : ExpressionLike ) : BasicExpression < boolean > {
126
+ return new Func ( `isUndefined` , [ toExpression ( value ) ] )
127
+ }
128
+
129
+ export function isNotUndefined ( value : ExpressionLike ) : BasicExpression < boolean > {
130
+ return new Func ( `isNotUndefined` , [ toExpression ( value ) ] )
131
+ }
132
+
133
+ export function isNull ( value : ExpressionLike ) : BasicExpression < boolean > {
134
+ return new Func ( `isNull` , [ toExpression ( value ) ] )
135
+ }
136
+
137
+ export function isNotNull ( value : ExpressionLike ) : BasicExpression < boolean > {
138
+ return new Func ( `isNotNull` , [ toExpression ( value ) ] )
139
+ }
140
+
124
141
export function inArray (
125
142
value : ExpressionLike ,
126
143
array : ExpressionLike
@@ -134,8 +151,25 @@ export function like(
134
151
| RefProxy < string | null >
135
152
| RefProxy < string | undefined >
136
153
| string
137
- | BasicExpression < string > ,
138
- right : string | RefProxy < string > | BasicExpression < string >
154
+ | string | null
155
+ | string | undefined
156
+ | BasicExpression < string >
157
+ | BasicExpression < string | null >
158
+ | BasicExpression < string | undefined >
159
+ | null
160
+ | undefined ,
161
+ right :
162
+ | string
163
+ | string | null
164
+ | string | undefined
165
+ | RefProxy < string >
166
+ | RefProxy < string | null >
167
+ | RefProxy < string | undefined >
168
+ | BasicExpression < string >
169
+ | BasicExpression < string | null >
170
+ | BasicExpression < string | undefined >
171
+ | null
172
+ | undefined
139
173
) : BasicExpression < boolean >
140
174
export function like ( left : any , right : any ) : BasicExpression < boolean > {
141
175
return new Func ( `like` , [ toExpression ( left ) , toExpression ( right ) ] )
@@ -147,8 +181,25 @@ export function ilike(
147
181
| RefProxy < string | null >
148
182
| RefProxy < string | undefined >
149
183
| string
150
- | BasicExpression < string > ,
151
- right : string | RefProxy < string > | BasicExpression < string >
184
+ | string | null
185
+ | string | undefined
186
+ | BasicExpression < string >
187
+ | BasicExpression < string | null >
188
+ | BasicExpression < string | undefined >
189
+ | null
190
+ | undefined ,
191
+ right :
192
+ | string
193
+ | string | null
194
+ | string | undefined
195
+ | RefProxy < string >
196
+ | RefProxy < string | null >
197
+ | RefProxy < string | undefined >
198
+ | BasicExpression < string >
199
+ | BasicExpression < string | null >
200
+ | BasicExpression < string | undefined >
201
+ | null
202
+ | undefined
152
203
) : BasicExpression < boolean > {
153
204
return new Func ( `ilike` , [ toExpression ( left ) , toExpression ( right ) ] )
154
205
}
@@ -159,33 +210,59 @@ export function upper(
159
210
arg :
160
211
| RefProxy < string >
161
212
| RefProxy < string | undefined >
213
+ | RefProxy < string | null >
162
214
| string
215
+ | string | undefined
216
+ | string | null
163
217
| BasicExpression < string >
164
- ) : BasicExpression < string > {
218
+ | BasicExpression < string | undefined >
219
+ | BasicExpression < string | null >
220
+ | undefined
221
+ | null
222
+ ) : BasicExpression < string | undefined | null > {
165
223
return new Func ( `upper` , [ toExpression ( arg ) ] )
166
224
}
167
225
168
226
export function lower (
169
227
arg :
170
228
| RefProxy < string >
171
229
| RefProxy < string | undefined >
230
+ | RefProxy < string | null >
172
231
| string
232
+ | string | undefined
233
+ | string | null
173
234
| BasicExpression < string >
174
- ) : BasicExpression < string > {
235
+ | BasicExpression < string | undefined >
236
+ | BasicExpression < string | null >
237
+ | undefined
238
+ | null
239
+ ) : BasicExpression < string | undefined | null > {
175
240
return new Func ( `lower` , [ toExpression ( arg ) ] )
176
241
}
177
242
178
243
export function length (
179
244
arg :
180
245
| RefProxy < string >
181
246
| RefProxy < string | undefined >
247
+ | RefProxy < string | null >
182
248
| RefProxy < Array < any > >
183
249
| RefProxy < Array < any > | undefined >
250
+ | RefProxy < Array < any > | null >
184
251
| string
252
+ | string | undefined
253
+ | string | null
185
254
| Array < any >
255
+ | Array < any > | undefined
256
+ | Array < any > | null
186
257
| BasicExpression < string >
258
+ | BasicExpression < string | undefined >
259
+ | BasicExpression < string | null >
187
260
| BasicExpression < Array < any > >
188
- ) : BasicExpression < number > {
261
+ | BasicExpression < Array < any > | undefined >
262
+ | BasicExpression < Array < any > | null >
263
+ | undefined
264
+ | null
265
+ ) : BasicExpression < number | undefined | null > {
189
266
return new Func ( `length` , [ toExpression ( arg ) ] )
190
267
}
191
268
@@ -209,14 +286,28 @@ export function add(
209
286
left :
210
287
| RefProxy < number >
211
288
| RefProxy < number | undefined >
289
+ | RefProxy < number | null >
212
290
| number
213
- | BasicExpression < number > ,
291
+ | number | undefined
292
+ | number | null
293
+ | BasicExpression < number >
294
+ | BasicExpression < number | undefined >
295
+ | BasicExpression < number | null >
296
+ | undefined
297
+ | null ,
214
298
right :
215
299
| RefProxy < number >
216
300
| RefProxy < number | undefined >
301
+ | RefProxy < number | null >
217
302
| number
303
+ | number | undefined
304
+ | number | null
218
305
| BasicExpression < number >
219
- ) : BasicExpression < number > {
306
+ | BasicExpression < number | undefined >
307
+ | BasicExpression < number | null >
308
+ | undefined
309
+ | null
310
+ ) : BasicExpression < number | undefined | null > {
220
311
return new Func ( `add` , [ toExpression ( left ) , toExpression ( right ) ] )
221
312
}
222
313
@@ -230,39 +321,67 @@ export function avg(
230
321
arg :
231
322
| RefProxy < number >
232
323
| RefProxy < number | undefined >
324
+ | RefProxy < number | null >
233
325
| number
326
+ | number | undefined
327
+ | number | null
234
328
| BasicExpression < number >
235
- ) : Aggregate < number > {
329
+ | BasicExpression < number | undefined >
330
+ | BasicExpression < number | null >
331
+ | undefined
332
+ | null
333
+ ) : Aggregate < number | undefined | null > {
236
334
return new Aggregate ( `avg` , [ toExpression ( arg ) ] )
237
335
}
238
336
239
337
export function sum (
240
338
arg :
241
339
| RefProxy < number >
242
340
| RefProxy < number | undefined >
341
+ | RefProxy < number | null >
243
342
| number
343
+ | number | undefined
344
+ | number | null
244
345
| BasicExpression < number >
245
- ) : Aggregate < number > {
346
+ | BasicExpression < number | undefined >
347
+ | BasicExpression < number | null >
348
+ | undefined
349
+ | null
350
+ ) : Aggregate < number | undefined | null > {
246
351
return new Aggregate ( `sum` , [ toExpression ( arg ) ] )
247
352
}
248
353
249
354
export function min (
250
355
arg :
251
356
| RefProxy < number >
252
357
| RefProxy < number | undefined >
358
+ | RefProxy < number | null >
253
359
| number
360
+ | number | undefined
361
+ | number | null
254
362
| BasicExpression < number >
255
- ) : Aggregate < number > {
363
+ | BasicExpression < number | undefined >
364
+ | BasicExpression < number | null >
365
+ | undefined
366
+ | null
367
+ ) : Aggregate < number | undefined | null > {
256
368
return new Aggregate ( `min` , [ toExpression ( arg ) ] )
257
369
}
258
370
259
371
export function max (
260
372
arg :
261
373
| RefProxy < number >
262
374
| RefProxy < number | undefined >
375
+ | RefProxy < number | null >
263
376
| number
377
+ | number | undefined
378
+ | number | null
264
379
| BasicExpression < number >
265
- ) : Aggregate < number > {
380
+ | BasicExpression < number | undefined >
381
+ | BasicExpression < number | null >
382
+ | undefined
383
+ | null
384
+ ) : Aggregate < number | undefined | null > {
266
385
return new Aggregate ( `max` , [ toExpression ( arg ) ] )
267
386
}
268
387
0 commit comments