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

Add 'format' function to PostgresModule #184 #415

Merged

Conversation

TobiasPfeifer
Copy link
Contributor

implements format function in ProstgresModule #184

@TobiasPfeifer TobiasPfeifer requested a review from a team as a code owner March 28, 2021 19:45
@@ -227,6 +227,12 @@ trait PostgresModule extends Jdbc { self =>
FunctionDef[Timestampz, Timestampz](FunctionName("make_timestamptz"))
val Encode = FunctionDef[(Chunk[Byte], String), String](FunctionName("encode"))
val Decode = FunctionDef[(String, String), Chunk[Byte]](FunctionName("decode"))
val Format0 = FunctionDef[String, String](FunctionName("format")) // TODO: varargs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

varargs not available yet (see also 'concat' function)
Is there an open issue for varargs support? otherwise I would open an issue to track this (and might give it a try)

Copy link
Member

Choose a reason for hiding this comment

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

Created issue here #439

testM("format4") {
import Expr._

val query = select(Format4("Person: %s %s with null-literal %L and non-null-literal %L ", Customers.fName, Customers.lName, "FIXME: NULL", "literal")) from customers
Copy link
Contributor Author

Choose a reason for hiding this comment

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

couldn't find a solution to specify NULL
tried Option.empty[String] and null.asInstanceOf[String]

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, Options are not well supported at this point.

@jczuchnowski
Copy link
Member

Thanks for this @TobiasPfeifer !

@jczuchnowski jczuchnowski merged commit 7e84011 into zio:master Apr 26, 2021
amrkamel pushed a commit to amrkamel/zio-sql that referenced this pull request May 26, 2022
…-function

Add 'format' function to PostgresModule zio#184
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