Skip to content

Commit

Permalink
Merge pull request #240 from gemini-hlsw/parens
Browse files Browse the repository at this point in the history
add parens around binops
  • Loading branch information
milessabin authored Jul 26, 2022
2 parents 0709849 + 74857ff commit 065bc54
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions modules/doobie/src/test/scala/DoobieSuites.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ final class GraphSpec extends DoobieDatabaseSuite with SqlGraphSpec {
}

final class InterfacesSpec extends DoobieDatabaseSuite with SqlInterfacesSpec {
lazy val mapping =
lazy val mapping =
new DoobieTestMapping(xa) with SqlInterfacesMapping[IO] {
def entityType: Codec =
(Meta[Int].timap(EntityType.fromInt)(EntityType.toInt), false)
Expand All @@ -61,15 +61,15 @@ final class JsonbSpec extends DoobieDatabaseSuite with SqlJsonbSpec {
}

final class MovieSpec extends DoobieDatabaseSuite with SqlMovieSpec {
lazy val mapping =
lazy val mapping =
new DoobieTestMapping(xa) with SqlMovieMapping[IO] {
def genre: Codec = (Meta[Int].imap(Genre.fromInt)(Genre.toInt), false)
def feature: Codec = (Meta[String].imap(Feature.fromString)(_.toString), false)
}
}

final class MutationSpec extends DoobieDatabaseSuite with SqlMutationSpec {
lazy val mapping =
lazy val mapping =
new DoobieTestMapping(xa) with SqlMutationMapping[IO] {
def updatePopulation(id: Int, population: Int): IO[Unit] =
sql"update city set population=$population where id=$id"
Expand All @@ -94,7 +94,7 @@ final class ProjectionSpec extends DoobieDatabaseSuite with SqlProjectionSpec {
}

final class RecursiveInterfacesSpec extends DoobieDatabaseSuite with SqlRecursiveInterfacesSpec {
lazy val mapping =
lazy val mapping =
new DoobieTestMapping(xa) with SqlRecursiveInterfacesMapping[IO] {
def itemType: Codec =
(Meta[Int].timap(ItemType.fromInt)(ItemType.toInt), false)
Expand Down Expand Up @@ -124,7 +124,7 @@ final class WorldCompilerSpec extends DoobieDatabaseSuite with SqlWorldCompilerS
DoobieMonitor.statsMonitor[IO].map(mon => (new DoobieTestMapping(xa, mon) with SqlWorldMapping[IO], mon))

def simpleRestrictedQuerySql: String =
"SELECT country.code , country.name FROM country WHERE (country.code = ?)"
"SELECT country.code , country.name FROM country WHERE (( country.code = ?) )"

def simpleFilteredQuerySql: String =
"SELECT city.id , city.name FROM city WHERE (city.name ILIKE ?)"
Expand Down
10 changes: 5 additions & 5 deletions modules/skunk/src/test/scala/SkunkSuites.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ final class GraphSpec extends SkunkDatabaseSuite with SqlGraphSpec {
}

final class InterfacesSpec extends SkunkDatabaseSuite with SqlInterfacesSpec {
lazy val mapping =
lazy val mapping =
new SkunkTestMapping(pool) with SqlInterfacesMapping[IO] {
def entityType: Codec =
(codec.int4.imap(EntityType.fromInt)(EntityType.toInt), false)
Expand All @@ -61,15 +61,15 @@ final class JsonbSpec extends SkunkDatabaseSuite with SqlJsonbSpec {
}

final class MovieSpec extends SkunkDatabaseSuite with SqlMovieSpec {
lazy val mapping =
lazy val mapping =
new SkunkTestMapping(pool) with SqlMovieMapping[IO] {
def genre: Codec = (codec.int4.imap(Genre.fromInt)(Genre.toInt), false)
def feature: Codec = (codec.varchar.imap(Feature.fromString)(_.toString), false)
}
}

final class MutationSpec extends SkunkDatabaseSuite with SqlMutationSpec {
lazy val mapping =
lazy val mapping =
new SkunkTestMapping(pool) with SqlMutationMapping[IO] {
def updatePopulation(id: Int, population: Int): IO[Unit] =
pool.use { s =>
Expand Down Expand Up @@ -97,7 +97,7 @@ final class ProjectionSpec extends SkunkDatabaseSuite with SqlProjectionSpec {
}

final class RecursiveInterfacesSpec extends SkunkDatabaseSuite with SqlRecursiveInterfacesSpec {
lazy val mapping =
lazy val mapping =
new SkunkTestMapping(pool) with SqlRecursiveInterfacesMapping[IO] {
def itemType: Codec =
(codec.int4.imap(ItemType.fromInt)(ItemType.toInt), false)
Expand Down Expand Up @@ -127,7 +127,7 @@ final class WorldCompilerSpec extends SkunkDatabaseSuite with SqlWorldCompilerSp
SkunkMonitor.statsMonitor[IO].map(mon => (new SkunkTestMapping(pool, mon) with SqlWorldMapping[IO], mon))

def simpleRestrictedQuerySql: String =
"SELECT country.code, country.name FROM country WHERE (country.code = $1)"
"SELECT country.code, country.name FROM country WHERE ((country.code = $1))"

def simpleFilteredQuerySql: String =
"SELECT city.id, city.name FROM city WHERE (city.name ILIKE $1)"
Expand Down
2 changes: 1 addition & 1 deletion modules/sql/src/main/scala/SqlMapping.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ trait SqlMapping[F[_]] extends CirceMapping[F] with SqlModule[F] { self =>
for {
fx <- loop(x, e)
fy <- loop(y, e)
} yield fx |+| op |+| fy
} yield Fragments.const("(") |+| fx |+| op |+| fy |+| Fragments.const(")")
}

def binaryOp2(x: Term[_])(op: Fragment => Fragment, enc: Option[Encoder] = None): Aliased[Fragment] = {
Expand Down

0 comments on commit 065bc54

Please sign in to comment.