Skip to content

feat: Add NULLIF() implementation#1676

Open
bakasmarius wants to merge 19 commits intokysely-org:masterfrom
bakasmarius:feature/1429-add-nullif-implementation
Open

feat: Add NULLIF() implementation#1676
bakasmarius wants to merge 19 commits intokysely-org:masterfrom
bakasmarius:feature/1429-add-nullif-implementation

Conversation

@bakasmarius
Copy link
Copy Markdown

Closes #1429.
Sorry it took longer than I expected, it wasn't as easy to implement as I initially thought 😅
Any comments with suggestions to edit/rename/refactor/test/etc are welcome 😉

# Conflicts:
#	src/expression/expression-builder.ts
#	src/operation-node/operation-node-transformer.ts
#	src/operation-node/operation-node-visitor.ts
#	src/query-compiler/default-query-compiler.ts
@vercel
Copy link
Copy Markdown

vercel bot commented Jan 13, 2026

@bakasmarius is attempting to deploy a commit to the Kysely Team Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Jan 15, 2026

commit: 1b29008

Comment thread src/operation-node/null-if-node.ts Outdated
Comment thread src/operation-node/operator-node.ts
Comment thread src/operation-node/select-query-node.ts Outdated
Comment thread test/node/src/null-if.test.ts Outdated
Comment thread test/node/src/null-if.test.ts Outdated
Comment thread test/node/src/null-if.test.ts Outdated
Comment thread src/expression/expression-builder.ts Outdated
Comment thread src/expression/expression-builder.ts Outdated
Comment thread src/expression/expression-builder.ts Outdated
Comment thread src/expression/expression-builder.ts Outdated
@igalklebanov igalklebanov added enhancement New feature or request api Related to library's API mysql Related to MySQL labels Jan 31, 2026
@igalklebanov igalklebanov added mssql Related to MS SQL Server (MSSQL) sqlite Related to sqlite postgres Related to PostgreSQL oracle Related to Oracle labels Jan 31, 2026
Copy link
Copy Markdown
Contributor

@aymenhmaidiwastaken aymenhmaidiwastaken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit: the rest of the codebase uses const/let exclusively. These var declarations should be const since they're never reassigned.

Comment thread src/query-builder/function-module.ts Outdated
expr1: T,
expr2: number | boolean | string | null,
): ExpressionWrapper<DB, TB, T | null> {
var v1 =
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var v1 =
const v1 =

Comment thread src/query-builder/function-module.ts Outdated
: isSafeImmediateValue(expr1)
? parseSafeImmediateValue(expr1)
: parseReferenceExpression(expr1)
var v2 =
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var v2 =
const v2 =

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder how I missed that 😄
@igalklebanov maybe add some lint rules for that?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's on the list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Related to library's API enhancement New feature or request mssql Related to MS SQL Server (MSSQL) mysql Related to MySQL oracle Related to Oracle postgres Related to PostgreSQL sqlite Related to sqlite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add nullif(value1, value2).

3 participants