From 42e7a49f89616685bffbcb224e0da67c515be9f8 Mon Sep 17 00:00:00 2001 From: takapi327 Date: Wed, 1 Jan 2025 18:44:03 +0900 Subject: [PATCH] Action sbt scalafmtAll --- .../src/main/scala/ldbc/dsl/Query.scala | 4 ++-- .../scala/ldbc/dsl/ResultSetConsumer.scala | 2 ++ .../exception/DecodeFailureException.scala | 23 ++++++++++--------- .../ldbc/dsl/exception/LdbcException.scala | 2 +- .../ldbc/query/builder/syntax/package.scala | 3 ++- .../scala/ldbc/schema/syntax/package.scala | 3 ++- 6 files changed, 21 insertions(+), 16 deletions(-) diff --git a/module/ldbc-dsl/src/main/scala/ldbc/dsl/Query.scala b/module/ldbc-dsl/src/main/scala/ldbc/dsl/Query.scala index b7faef914..7a5f5ed49 100644 --- a/module/ldbc-dsl/src/main/scala/ldbc/dsl/Query.scala +++ b/module/ldbc-dsl/src/main/scala/ldbc/dsl/Query.scala @@ -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 ) @@ -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 ) diff --git a/module/ldbc-dsl/src/main/scala/ldbc/dsl/ResultSetConsumer.scala b/module/ldbc-dsl/src/main/scala/ldbc/dsl/ResultSetConsumer.scala index 5c03691e7..62bb43ad7 100644 --- a/module/ldbc-dsl/src/main/scala/ldbc/dsl/ResultSetConsumer.scala +++ b/module/ldbc-dsl/src/main/scala/ldbc/dsl/ResultSetConsumer.scala @@ -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 */ diff --git a/module/ldbc-dsl/src/main/scala/ldbc/dsl/exception/DecodeFailureException.scala b/module/ldbc-dsl/src/main/scala/ldbc/dsl/exception/DecodeFailureException.scala index 031567950..d9c39556a 100644 --- a/module/ldbc-dsl/src/main/scala/ldbc/dsl/exception/DecodeFailureException.scala +++ b/module/ldbc-dsl/src/main/scala/ldbc/dsl/exception/DecodeFailureException.scala @@ -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" diff --git a/module/ldbc-dsl/src/main/scala/ldbc/dsl/exception/LdbcException.scala b/module/ldbc-dsl/src/main/scala/ldbc/dsl/exception/LdbcException.scala index 4b7400445..9851f6cbb 100644 --- a/module/ldbc-dsl/src/main/scala/ldbc/dsl/exception/LdbcException.scala +++ b/module/ldbc-dsl/src/main/scala/ldbc/dsl/exception/LdbcException.scala @@ -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] = diff --git a/module/ldbc-query-builder/src/main/scala/ldbc/query/builder/syntax/package.scala b/module/ldbc-query-builder/src/main/scala/ldbc/query/builder/syntax/package.scala index a79e4e6ab..b6f030f0c 100644 --- a/module/ldbc-query-builder/src/main/scala/ldbc/query/builder/syntax/package.scala +++ b/module/ldbc-query-builder/src/main/scala/ldbc/query/builder/syntax/package.scala @@ -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 ) diff --git a/module/ldbc-schema/src/main/scala/ldbc/schema/syntax/package.scala b/module/ldbc-schema/src/main/scala/ldbc/schema/syntax/package.scala index dec04276c..ada0fe608 100644 --- a/module/ldbc-schema/src/main/scala/ldbc/schema/syntax/package.scala +++ b/module/ldbc-schema/src/main/scala/ldbc/schema/syntax/package.scala @@ -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 )