Skip to content

Commit 818cd7b

Browse files
committed
checkpoint
1 parent 9ca2797 commit 818cd7b

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

packages/db/src/query/compiler/evaluators.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,36 @@ function compileFunction(func: Func, isSingleRow: boolean): (data: any) => any {
334334
}
335335
}
336336

337+
// Null/undefined checking functions
338+
case `isUndefined`: {
339+
const arg = compiledArgs[0]!
340+
return (data) => {
341+
const value = arg(data)
342+
return value === undefined
343+
}
344+
}
345+
case `isNotUndefined`: {
346+
const arg = compiledArgs[0]!
347+
return (data) => {
348+
const value = arg(data)
349+
return value !== undefined
350+
}
351+
}
352+
case `isNull`: {
353+
const arg = compiledArgs[0]!
354+
return (data) => {
355+
const value = arg(data)
356+
return value === null
357+
}
358+
}
359+
case `isNotNull`: {
360+
const arg = compiledArgs[0]!
361+
return (data) => {
362+
const value = arg(data)
363+
return value !== null
364+
}
365+
}
366+
337367
default:
338368
throw new UnknownFunctionError(func.name)
339369
}

0 commit comments

Comments
 (0)