Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Option.orElse #2790

Merged
merged 2 commits into from
Jun 27, 2023
Merged

Support Option.orElse #2790

merged 2 commits into from
Jun 27, 2023

Conversation

juliano
Copy link
Collaborator

@juliano juliano commented Jun 27, 2023

Fixes #1691

Problem

Quill does not support Option.orElse

Solution

Implemented support for

if columnA.orElse(columnB).forall(_ == value)

and

if columnA.orElse(columnB).exists(_ == value)

syntax

Notes

Additional notes.

Checklist

  • Unit test all changes
  • Update README.md if applicable
  • Add [WIP] to the pull request title if it's work in progress
  • Squash commits that aren't meaningful changes
  • Run sbt scalariformFormat test:scalariformFormat to make sure that the source files are formatted

@getquill/maintainers

@juliano juliano requested a review from guizmaii June 27, 2023 07:16
@@ -24,7 +25,31 @@ class FlattenOptionOperationSpec extends Spec { // hello
o.getOrElse(1)
}
new FlattenOptionOperation(AnsiConcat, TraceConfig.Empty)(q.ast.body: Ast) mustEqual
If(BinaryOperation(Ident("o"), EqualityOperator.`_!=`, NullValue), Ident("o"), Constant.auto(1))
IfExist(o, o, c1)
Copy link
Member

Choose a reason for hiding this comment

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

Why are we changing the test here? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's just a simplification, they are equivalent :)

@juliano juliano merged commit 872c797 into zio:master Jun 27, 2023
@juliano juliano deleted the support-option-or-else branch June 27, 2023 10:17
jilen pushed a commit that referenced this pull request Jun 11, 2024
* support Option.orElse

* ooops
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.

Support Option.orElse
2 participants