Skip to content

Commit

Permalink
Action sbt scalafmtAll
Browse files Browse the repository at this point in the history
  • Loading branch information
takapi327 committed Jan 1, 2025
1 parent 360fd67 commit 42e7a49
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
4 changes: 2 additions & 2 deletions module/ldbc-dsl/src/main/scala/ldbc/dsl/Query.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ object Query:
for
prepareStatement <- connection.prepareStatement(statement)
resultSet <- paramBind(prepareStatement, params) >> prepareStatement.executeQuery()
result <- summon[ResultSetConsumer[F, G[T]]].consume(resultSet, statement) <* prepareStatement.close()
result <- summon[ResultSetConsumer[F, G[T]]].consume(resultSet, statement) <* prepareStatement.close()
yield result
)

Expand All @@ -66,6 +66,6 @@ object Query:
for
prepareStatement <- connection.prepareStatement(statement)
resultSet <- paramBind(prepareStatement, params) >> prepareStatement.executeQuery()
result <- summon[ResultSetConsumer[F, T]].consume(resultSet, statement) <* prepareStatement.close()
result <- summon[ResultSetConsumer[F, T]].consume(resultSet, statement) <* prepareStatement.close()
yield result
)
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ trait ResultSetConsumer[F[_], T]:
* @param resultSet
* A table of data representing a database result set, which is usually generated by executing a statement that
* queries the database.
* @param statement
* Statement that configured the ResultSet
* @return
* Type you want to build with data obtained from ResultSet
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,26 @@ package ldbc.dsl.exception
* The subclass of [[LdbcException]] thrown when an attempt to read a value from the [[ldbc.sql.ResultSet]] failed due to an error.
*/
class DecodeFailureException(
message: String,
offset: Int,
message: String,
offset: Int,
statement: String
) extends LdbcException(
message,
Some(
s"""
| ${Console.CYAN}I tried to read a value from the ${Console.RED + offset + Console.CYAN} th position of the ResultSet,
Some(s"""
| ${ Console.CYAN }I tried to read a value from the ${ Console.RED + offset + Console.CYAN } th position of the ResultSet,
| but it does not seem to match the number I am trying to retrieve from the database.
|
| ${Console.GREEN + statement +Console.RESET}
| ${ Console.GREEN + statement + Console.RESET }
|""".stripMargin),
Some(s"""${Console.CYAN}Try building a Decoder that matches the number and type of cases to be acquired as follows.
Some(
s"""${ Console.CYAN }Try building a Decoder that matches the number and type of cases to be acquired as follows.
|
| given Decoder[(Int, String)] = Decoder[Int] *: Decoder[String]
| ${Console.RED + " " * 28}^${Console.RESET}${Console.RED + " " * 8}^${Console.CYAN}
| sql"SELECT c1, c2 FROM table".query[(Int, String)]${Console.RESET}
| ${Console.RED + " " * 22}^${Console.RESET}${Console.RED + " " * 3}^${Console.RESET}
|""".stripMargin)
| ${ Console.RED + " " * 28 }^${ Console.RESET }${ Console.RED + " " * 8 }^${ Console.CYAN }
| sql"SELECT c1, c2 FROM table".query[(Int, String)]${ Console.RESET }
| ${ Console.RED + " " * 22 }^${ Console.RESET }${ Console.RED + " " * 3 }^${ Console.RESET }
|""".stripMargin
)
):

override def title: String = "Decode Failure Exception"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class LdbcException(

protected def body: String =
s"""
|${ labeled(" Problem: ", message) }${ "\n| Detail: " + detail.orEmpty }${"\n| Hint: " + hint.orEmpty}
|${ labeled(" Problem: ", message) }${ "\n| Detail: " + detail.orEmpty }${ "\n| Hint: " + hint.orEmpty }
|""".stripMargin

protected def sections: List[String] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ package object syntax:
resultSet <-
paramBind(prepareStatement, command.params) >> prepareStatement.executeUpdate() >> prepareStatement
.getGeneratedKeys()
result <- summon[ResultSetConsumer[F, T]].consume(resultSet, command.statement) <* prepareStatement.close()
result <-
summon[ResultSetConsumer[F, T]].consume(resultSet, command.statement) <* prepareStatement.close()
yield result
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ package object syntax:
resultSet <-
paramBind(prepareStatement, command.params) >> prepareStatement.executeUpdate() >> prepareStatement
.getGeneratedKeys()
result <- summon[ResultSetConsumer[F, T]].consume(resultSet, command.statement) <* prepareStatement.close()
result <-
summon[ResultSetConsumer[F, T]].consume(resultSet, command.statement) <* prepareStatement.close()
yield result
)

Expand Down

0 comments on commit 42e7a49

Please sign in to comment.