-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add QueryPrinter
for getting a string representation of a Query
#106
Conversation
With the simple string concat printer
|
Benchmarks with the StringBuilder approach and also just calling
These are in operations per second, so higher is better. |
I had been hesitant to call this "done" because it doesn't expose any configuration, in particular whether or not the printer should force in For example we parse the following query: However, we also don't expose any configuration on the parsing side to explicitly say the default boolean ( We should offer this configuration at some point, but perhaps it's better in another PR. |
@@ -0,0 +1,95 @@ | |||
/* | |||
* Copyright 2022 CozyDev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated aside: do we need to update this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, we also don't expose any configuration on the parsing side to explicitly say the default boolean (OR vs AND). So adding this in this PR would be a bit of work.
We should offer this configuration at some point, but perhaps it's better in another PR.
I agree about offering the configuration, and agree that work is worth it's own PR
|
||
/** To run the benchmark from within sbt: | ||
* | ||
* jmh:run -i 10 -wi 10 -f 2 -t 1 pink.cozydev.lucille.benchmarks.QueryPrinterBenchmark |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not run the benchmarks, just fyi
import pink.cozydev.lucille.Query._ | ||
import cats.data.NonEmptyList | ||
|
||
class QueryPrinterSimpleQueriesSuite extends munit.FunSuite { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😎
Adds
QueryPrinter
to print out a string representation of aQuery
."cats jumped"~2
Resolves #107