Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasPfeifer authored and Tobias Pfeifer committed Mar 28, 2021
1 parent 6aec4a2 commit b1671e5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
12 changes: 6 additions & 6 deletions postgres/src/main/scala/zio/sql/postgresql/PostgresModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +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
val Format1 = FunctionDef[(String, Any), String](FunctionName("format"))
val Format2 = FunctionDef[(String, Any, Any), String](FunctionName("format"))
val Format3 = FunctionDef[(String, Any, Any, Any), String](FunctionName("format"))
val Format4 = FunctionDef[(String, Any, Any, Any, Any), String](FunctionName("format"))
val Format5 = FunctionDef[(String, Any, Any, Any, Any, Any), String](FunctionName("format"))
val Format0 = FunctionDef[String, String](FunctionName("format")) // TODO: varargs
val Format1 = FunctionDef[(String, Any), String](FunctionName("format"))
val Format2 = FunctionDef[(String, Any, Any), String](FunctionName("format"))
val Format3 = FunctionDef[(String, Any, Any, Any), String](FunctionName("format"))
val Format4 = FunctionDef[(String, Any, Any, Any, Any), String](FunctionName("format"))
val Format5 = FunctionDef[(String, Any, Any, Any, Any, Any), String](FunctionName("format"))
}

override def renderRead(read: self.Read[_]): String = {
Expand Down
25 changes: 22 additions & 3 deletions postgres/src/test/scala/zio/sql/postgresql/FunctionDefSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ object FunctionDefSpec extends PostgresRunnableSpec with ShopSchema {
testM("format3") {
import Expr._

val query = select(Format3("Person: %s %s with double quoted %I ", Customers.fName, Customers.lName, "identi fier")) from customers
val query = select(
Format3("Person: %s %s with double quoted %I ", Customers.fName, Customers.lName, "identi fier")
) from customers

val expected = Seq(
s"""Person: Ronald Russell with double quoted "identi fier" """,
Expand All @@ -220,7 +222,15 @@ object FunctionDefSpec extends PostgresRunnableSpec with ShopSchema {
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
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

val expected = Seq(
s"""Person: Ronald Russell with null-literal 'FIXME: NULL' and non-null-literal 'literal' """,
Expand All @@ -236,7 +246,16 @@ object FunctionDefSpec extends PostgresRunnableSpec with ShopSchema {
testM("format5") {
import Expr._

val query = select(Format5("Person: %s %s with more arguments than placeholders: %I %L ", Customers.fName, Customers.lName, "identifier", Reverse(Customers.fName), "unused")) from customers
val query = select(
Format5(
"Person: %s %s with more arguments than placeholders: %I %L ",
Customers.fName,
Customers.lName,
"identifier",
Reverse(Customers.fName),
"unused"
)
) from customers

val expected = Seq(
s"""Person: Ronald Russell with more arguments than placeholders: identifier 'dlanoR' """,
Expand Down

0 comments on commit b1671e5

Please sign in to comment.