-
Notifications
You must be signed in to change notification settings - Fork 34
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
Auto remove line breaks on Columns.Raw #544
Auto remove line breaks on Columns.Raw #544
Conversation
Hey, thanks for this PR! After looking at the other client libs, it seems like what they're doing something different: private fun String.clean(): String {
var quoted = false
val regex = Regex("\\s")
return this.map {
if (it == '"') {
quoted = !quoted
}
if (regex.matches(it.toString()) && !quoted) {
""
} else {
it
}
}.joinToString("")
} |
Hi all, @jan-tennert suggestion is the way to go, to keep same behavior across client libraries. |
That's cool, thanks for checking other client libraries to see their behaviour. |
@iruizmar what do you mean by hidden feature? I see it more as a convenience for using multiline You wish we had some doc entry mentioning that it is possible to use multiline queries? |
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.
We should probably add unit tests for multiline columns and quoted whitespaces, but that can be in another PR. Thanks!
We're now allowing spaces only if they are quoted. I think users won't know this feature if it's not documented. Even if I, honestly, can't see a usecase in which you'd want to have a white space. So yes, adding a section in the docs about this feels the correct approach. |
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
Solves #543
What is the new behavior?
Columns.Raw
now automatically gets rid of line breaksAdditional context
Let me know if that's not the correct place to introduce it.
Should we also auto add
trimIndent()
?