Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

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
Collaborator

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
Collaborator

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
Collaborator

Thanks for this @TobiasPfeifer !

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

Add 'format' function to PostgresModule zio-archive#184
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants