Skip to content

Allow ternary operator in filter expressions#54

Merged
OlivierCosti merged 4 commits intomasterfrom
ternary_operator_in_flter_expressions
Apr 9, 2026
Merged

Allow ternary operator in filter expressions#54
OlivierCosti merged 4 commits intomasterfrom
ternary_operator_in_flter_expressions

Conversation

@SH-Exact
Copy link
Copy Markdown
Contributor

@SH-Exact SH-Exact commented Feb 26, 2026

This PR introduces the support of the ternary operator in filter expressions. The operator's name is CASE and works with IF, THEN, ELSE.

wServices.article.some({
  where: {
    unit: {
	  EQ: {
	    CASE: {
		  IF: <filterExpression>,
		  THEN: <value>,
		  ELSE: <value>
	    }	  
	  }
    }
  }
})

Nested ternary operators are also possible

wServices.article.some({
  where: {
    unit: {
	  EQ: {
        CASE: {
          IF: <filterExpression>,
          THEN: <value>,
          ELSE: {
            CASE: {
              IF: <filterExpression>,
              THEN: <value>,
              ELSE: <value>
            }
          }
        }	  
	  }
    }
  }
})

@SH-Exact SH-Exact self-assigned this Feb 26, 2026
@OlivierCosti OlivierCosti self-requested a review February 27, 2026 05:55
@OlivierCosti
Copy link
Copy Markdown
Contributor

Getting a type error here:

Screenshot 2026-02-27 at 08 07 10

@SH-Exact SH-Exact requested a review from OlivierCosti March 9, 2026 15:22
@SH-Exact SH-Exact force-pushed the ternary_operator_in_flter_expressions branch from cb98d34 to 2fc29ae Compare March 30, 2026 14:15
@OlivierCosti OlivierCosti merged commit 30d8393 into master Apr 9, 2026
8 checks passed
@OlivierCosti OlivierCosti deleted the ternary_operator_in_flter_expressions branch April 9, 2026 07:03
@SH-Exact SH-Exact mentioned this pull request Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants