From d218bb25bca1d9b30a212f7fdf650f0ebbdb64ca Mon Sep 17 00:00:00 2001 From: takapi327 Date: Tue, 24 Dec 2024 21:00:05 +0900 Subject: [PATCH 1/8] Rename Executor to DBIO --- docs/src/main/scala/00-Setup.scala | 14 +++--- docs/src/main/scala/01-Program.scala | 2 +- docs/src/main/scala/02-Program.scala | 2 +- docs/src/main/scala/03-Program.scala | 2 +- docs/src/main/scala/04-Program.scala | 2 +- docs/src/main/scala/05-Program.scala | 4 +- docs/src/main/scala/0X-Cleanup.scala | 2 +- .../src/main/scala/ldbc/dsl/Executor.scala | 44 +++++++++--------- .../src/main/scala/ldbc/dsl/Mysql.scala | 8 ++-- .../src/main/scala/ldbc/dsl/Query.scala | 12 ++--- .../src/main/scala/ldbc/dsl/package.scala | 4 +- .../ldbc/query/builder/syntax/package.scala | 8 ++-- .../ldbc/query/builder/QuerySyntaxTest.scala | 2 +- .../scala/ldbc/schema/syntax/package.scala | 8 ++-- .../ldbc/statement/syntax/CommandSyntax.scala | 4 +- .../test/scala/ldbc/tests/ExecutorTest.scala | 46 +++++++++---------- .../TableQuerySelectConnectionTest.scala | 2 +- .../TableQueryUpdateConnectionTest.scala | 4 +- .../TableSchemaSelectConnectionTest.scala | 2 +- 19 files changed, 86 insertions(+), 86 deletions(-) diff --git a/docs/src/main/scala/00-Setup.scala b/docs/src/main/scala/00-Setup.scala index b1474cfa7..b0e775ef3 100644 --- a/docs/src/main/scala/00-Setup.scala +++ b/docs/src/main/scala/00-Setup.scala @@ -22,12 +22,12 @@ import ldbc.dsl.io.* // #given // #setupDatabase - val createDatabase: Executor[IO, Int] = + val createDatabase: DBIO[IO, Int] = sql"CREATE DATABASE IF NOT EXISTS sandbox_db".update // #setupDatabase // #setupUser - val createUser: Executor[IO, Int] = + val createUser: DBIO[IO, Int] = sql""" CREATE TABLE IF NOT EXISTS `user` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -40,7 +40,7 @@ import ldbc.dsl.io.* // #setupUser // #setupProduct - val createProduct: Executor[IO, Int] = + val createProduct: DBIO[IO, Int] = sql""" CREATE TABLE IF NOT EXISTS `product` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -53,7 +53,7 @@ import ldbc.dsl.io.* // #setupProduct // #setupOrder - val createOrder: Executor[IO, Int] = + val createOrder: DBIO[IO, Int] = sql""" CREATE TABLE IF NOT EXISTS `order` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -70,7 +70,7 @@ import ldbc.dsl.io.* // #setupOrder // #insertUser - val insertUser: Executor[IO, Int] = + val insertUser: DBIO[IO, Int] = sql""" INSERT INTO user (name, email) VALUES ('Alice', 'alice@example.com'), @@ -80,7 +80,7 @@ import ldbc.dsl.io.* // #insertUser // #insertProduct - val insertProduct: Executor[IO, Int] = + val insertProduct: DBIO[IO, Int] = sql""" INSERT INTO product (name, price) VALUES ('Laptop', 999.99), @@ -91,7 +91,7 @@ import ldbc.dsl.io.* // #insertProduct // #insertOrder - val insertOrder: Executor[IO, Int] = + val insertOrder: DBIO[IO, Int] = sql""" INSERT INTO `order` (user_id, product_id, quantity) VALUES (1, 1, 1), -- Alice ordered 1 Laptop diff --git a/docs/src/main/scala/01-Program.scala b/docs/src/main/scala/01-Program.scala index 8e26ab76a..0143fb175 100644 --- a/docs/src/main/scala/01-Program.scala +++ b/docs/src/main/scala/01-Program.scala @@ -19,7 +19,7 @@ import ldbc.dsl.io.* // #given // #program - val program: Executor[IO, Int] = Executor.pure[IO, Int](1) + val program: DBIO[IO, Int] = DBIO.pure[IO, Int](1) // #program // #connection diff --git a/docs/src/main/scala/02-Program.scala b/docs/src/main/scala/02-Program.scala index 69ab6c280..28325f594 100644 --- a/docs/src/main/scala/02-Program.scala +++ b/docs/src/main/scala/02-Program.scala @@ -20,7 +20,7 @@ import ldbc.dsl.io.* // #given // #program - val program: Executor[IO, Option[Int]] = sql"SELECT 2".query[Int].to[Option] + val program: DBIO[IO, Option[Int]] = sql"SELECT 2".query[Int].to[Option] // #program // #connection diff --git a/docs/src/main/scala/03-Program.scala b/docs/src/main/scala/03-Program.scala index e3b6ba165..9793d4128 100644 --- a/docs/src/main/scala/03-Program.scala +++ b/docs/src/main/scala/03-Program.scala @@ -22,7 +22,7 @@ import ldbc.dsl.io.* // #given // #program - val program: Executor[IO, (List[Int], Option[Int], Int)] = + val program: DBIO[IO, (List[Int], Option[Int], Int)] = for result1 <- sql"SELECT 1".query[Int].to[List] result2 <- sql"SELECT 2".query[Int].to[Option] diff --git a/docs/src/main/scala/04-Program.scala b/docs/src/main/scala/04-Program.scala index 4fc0758df..af4bdc1b9 100644 --- a/docs/src/main/scala/04-Program.scala +++ b/docs/src/main/scala/04-Program.scala @@ -20,7 +20,7 @@ import ldbc.dsl.io.* // #given // #program - val program: Executor[IO, Int] = + val program: DBIO[IO, Int] = sql"INSERT INTO user (name, email) VALUES ('Carol', 'carol@example.com')".update // #program diff --git a/docs/src/main/scala/05-Program.scala b/docs/src/main/scala/05-Program.scala index 1dcf42be9..009e2dfdc 100644 --- a/docs/src/main/scala/05-Program.scala +++ b/docs/src/main/scala/05-Program.scala @@ -28,7 +28,7 @@ import ldbc.dsl.codec.* case Status.Active => true case Status.InActive => false - val program1: Executor[IO, Int] = + val program1: DBIO[IO, Int] = sql"INSERT INTO user (name, email, status) VALUES (${ "user 1" }, ${ "user@example.com" }, ${ Status.Active })".update given Decoder.Elem[Status] = Decoder.Elem.mapping[Boolean, Status] { @@ -36,7 +36,7 @@ import ldbc.dsl.codec.* case false => Status.InActive } - val program2: Executor[IO, (String, String, Status)] = + val program2: DBIO[IO, (String, String, Status)] = sql"SELECT name, email, status FROM user WHERE id = 1".query[(String, String, Status)].unsafe def connection = Connection[IO]( diff --git a/docs/src/main/scala/0X-Cleanup.scala b/docs/src/main/scala/0X-Cleanup.scala index 19ec5dce4..e73356408 100644 --- a/docs/src/main/scala/0X-Cleanup.scala +++ b/docs/src/main/scala/0X-Cleanup.scala @@ -20,7 +20,7 @@ import ldbc.dsl.io.* // #given // #cleanupDatabase - val dropDatabase: Executor[IO, Int] = + val dropDatabase: DBIO[IO, Int] = sql"DROP DATABASE IF EXISTS sandbox_db".update // #cleanupDatabase diff --git a/module/ldbc-dsl/src/main/scala/ldbc/dsl/Executor.scala b/module/ldbc-dsl/src/main/scala/ldbc/dsl/Executor.scala index 4dbcdca2e..074f5948d 100644 --- a/module/ldbc-dsl/src/main/scala/ldbc/dsl/Executor.scala +++ b/module/ldbc-dsl/src/main/scala/ldbc/dsl/Executor.scala @@ -24,7 +24,7 @@ import ldbc.dsl.logging.* * @tparam T * The result type of the query */ -trait Executor[F[_]: Temporal, T]: +trait DBIO[F[_]: Temporal, T]: private[ldbc] def execute(connection: Connection[F])(using logHandler: LogHandler[F]): F[T] @@ -64,60 +64,60 @@ trait Executor[F[_]: Temporal, T]: .makeCase(acquire)(release) .use(execute) -object Executor: +object DBIO: private[ldbc] case class Impl[F[_]: Temporal, T]( statement: String, params: List[Parameter], run: Connection[F] => F[T] - ) extends Executor[F, T]: + ) extends DBIO[F, T]: private[ldbc] def execute(connection: Connection[F])(using logHandler: LogHandler[F]): F[T] = run(connection) .onError(ex => logHandler.run(LogEvent.ProcessingFailure(statement, params.map(_.value), ex))) <* logHandler.run(LogEvent.Success(statement, params.map(_.value))) - def pure[F[_]: Temporal, T](value: T): Executor[F, T] = - new Executor[F, T]: + def pure[F[_]: Temporal, T](value: T): DBIO[F, T] = + new DBIO[F, T]: override private[ldbc] def execute(connection: Connection[F])(using LogHandler[F]): F[T] = Monad[F].pure(value) override def readOnly(connection: Connection[F])(using LogHandler[F]): F[T] = Monad[F].pure(value) override def commit(connection: Connection[F])(using LogHandler[F]): F[T] = Monad[F].pure(value) override def rollback(connection: Connection[F])(using LogHandler[F]): F[T] = Monad[F].pure(value) override def transaction(connection: Connection[F])(using LogHandler[F]): F[T] = Monad[F].pure(value) - def raiseError[F[_]: Temporal, A](e: Throwable): Executor[F, A] = - new Executor[F, A]: + def raiseError[F[_]: Temporal, A](e: Throwable): DBIO[F, A] = + new DBIO[F, A]: override private[ldbc] def execute(connection: Connection[F])(using LogHandler[F]): F[A] = MonadError[F, Throwable].raiseError(e) - given [F[_]: Temporal]: Functor[[T] =>> Executor[F, T]] with - override def map[A, B](fa: Executor[F, A])(f: A => B): Executor[F, B] = - new Executor[F, B]: + given [F[_]: Temporal]: Functor[[T] =>> DBIO[F, T]] with + override def map[A, B](fa: DBIO[F, A])(f: A => B): DBIO[F, B] = + new DBIO[F, B]: override private[ldbc] def execute(connection: Connection[F])(using LogHandler[F]): F[B] = fa.execute(connection).map(f) - given [F[_]: Temporal]: MonadError[[T] =>> Executor[F, T], Throwable] with - override def pure[A](x: A): Executor[F, A] = Executor.pure(x) + given [F[_]: Temporal]: MonadError[[T] =>> DBIO[F, T], Throwable] with + override def pure[A](x: A): DBIO[F, A] = DBIO.pure(x) - override def flatMap[A, B](fa: Executor[F, A])(f: A => Executor[F, B]): Executor[F, B] = - new Executor[F, B]: + override def flatMap[A, B](fa: DBIO[F, A])(f: A => DBIO[F, B]): DBIO[F, B] = + new DBIO[F, B]: override private[ldbc] def execute(connection: Connection[F])(using LogHandler[F]): F[B] = fa.execute(connection).flatMap(a => f(a).execute(connection)) - override def tailRecM[A, B](a: A)(f: A => Executor[F, Either[A, B]]): Executor[F, B] = - new Executor[F, B]: + override def tailRecM[A, B](a: A)(f: A => DBIO[F, Either[A, B]]): DBIO[F, B] = + new DBIO[F, B]: override private[ldbc] def execute(connection: Connection[F])(using logHandler: LogHandler[F]): F[B] = MonadError[F, Throwable].tailRecM(a)(a => f(a).execute(connection)) - override def ap[A, B](ff: Executor[F, A => B])(fa: Executor[F, A]): Executor[F, B] = - new Executor[F, B]: + override def ap[A, B](ff: DBIO[F, A => B])(fa: DBIO[F, A]): DBIO[F, B] = + new DBIO[F, B]: override private[ldbc] def execute(connection: Connection[F])(using logHandler: LogHandler[F]): F[B] = (ff.execute(connection), fa.execute(connection)).mapN(_(_)) - override def raiseError[A](e: Throwable): Executor[F, A] = - Executor.raiseError(e) + override def raiseError[A](e: Throwable): DBIO[F, A] = + DBIO.raiseError(e) - override def handleErrorWith[A](fa: Executor[F, A])(f: Throwable => Executor[F, A]): Executor[F, A] = - new Executor[F, A]: + override def handleErrorWith[A](fa: DBIO[F, A])(f: Throwable => DBIO[F, A]): DBIO[F, A] = + new DBIO[F, A]: override private[ldbc] def execute(connection: Connection[F])(using LogHandler[F]): F[A] = fa.execute(connection).handleErrorWith(e => f(e).execute(connection)) diff --git a/module/ldbc-dsl/src/main/scala/ldbc/dsl/Mysql.scala b/module/ldbc-dsl/src/main/scala/ldbc/dsl/Mysql.scala index 9d8b51c2f..ea824cf50 100644 --- a/module/ldbc-dsl/src/main/scala/ldbc/dsl/Mysql.scala +++ b/module/ldbc-dsl/src/main/scala/ldbc/dsl/Mysql.scala @@ -72,8 +72,8 @@ case class Mysql[F[_]: Temporal](statement: String, params: List[Parameter.Dynam * @return * The number of rows updated */ - def update: Executor[F, Int] = - Executor.Impl[F, Int]( + def update: DBIO[F, Int] = + DBIO.Impl[F, Int]( statement, params, connection => @@ -97,10 +97,10 @@ case class Mysql[F[_]: Temporal](statement: String, params: List[Parameter.Dynam * @return * The primary key value */ - def returning[T <: String | Int | Long](using decoder: Decoder.Elem[T]): Executor[F, T] = + def returning[T <: String | Int | Long](using decoder: Decoder.Elem[T]): DBIO[F, T] = given Decoder[T] = Decoder.one[T] - Executor.Impl[F, T]( + DBIO.Impl[F, T]( statement, params, connection => 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 1e077a740..981441b16 100644 --- a/module/ldbc-dsl/src/main/scala/ldbc/dsl/Query.scala +++ b/module/ldbc-dsl/src/main/scala/ldbc/dsl/Query.scala @@ -27,13 +27,13 @@ trait Query[F[_], T]: /** * Functions for safely retrieving data from a database in an array or Option type. */ - def to[G[_]](using FactoryCompat[T, G[T]]): Executor[F, G[T]] + def to[G[_]](using FactoryCompat[T, G[T]]): DBIO[F, G[T]] /** * A method to return the data to be retrieved from the database as is. If the data does not exist, an exception is * raised. Use the [[to]] method if you want to retrieve individual data. */ - def unsafe: Executor[F, T] + def unsafe: DBIO[F, T] object Query: @@ -45,8 +45,8 @@ object Query: given Decoder[T] = decoder - override def to[G[_]](using FactoryCompat[T, G[T]]): Executor[F, G[T]] = - Executor.Impl[F, G[T]]( + override def to[G[_]](using FactoryCompat[T, G[T]]): DBIO[F, G[T]] = + DBIO.Impl[F, G[T]]( statement, params, connection => @@ -59,8 +59,8 @@ object Query: yield result ) - override def unsafe: Executor[F, T] = - Executor.Impl[F, T]( + override def unsafe: DBIO[F, T] = + DBIO.Impl[F, T]( statement, params, connection => diff --git a/module/ldbc-dsl/src/main/scala/ldbc/dsl/package.scala b/module/ldbc-dsl/src/main/scala/ldbc/dsl/package.scala index 2bcf63766..d0962b8cd 100644 --- a/module/ldbc-dsl/src/main/scala/ldbc/dsl/package.scala +++ b/module/ldbc-dsl/src/main/scala/ldbc/dsl/package.scala @@ -190,8 +190,8 @@ package object dsl: def orderByOpt(s1: Option[SQL], s2: Option[SQL], ss: Option[SQL]*): Mysql[F] = orderByOpt((s1 :: s2 :: ss.toList).flatten) - type ExecutorIO[T] = ldbc.dsl.Executor[F, T] - export ldbc.dsl.Executor + //type DBIO[T] = ldbc.dsl.DBIO[F, T] + export ldbc.dsl.DBIO export ldbc.dsl.logging.LogHandler 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 43d8b8b6e..99ff2f0ea 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 @@ -42,8 +42,8 @@ package object syntax: case _ => DslQuery.Impl[F, P](query.statement, query.params, Decoder.derivedProduct(m1)) extension (command: Command) - def update: Executor[F, Int] = - Executor.Impl[F, Int]( + def update: DBIO[F, Int] = + DBIO.Impl[F, Int]( command.statement, command.params, connection => @@ -55,10 +55,10 @@ package object syntax: yield result ) - def returning[T <: String | Int | Long](using decoder: Decoder.Elem[T]): Executor[F, T] = + def returning[T <: String | Int | Long](using decoder: Decoder.Elem[T]): DBIO[F, T] = given Decoder[T] = Decoder.one[T] - Executor.Impl[F, T]( + DBIO.Impl[F, T]( command.statement, command.params, connection => diff --git a/module/ldbc-query-builder/src/test/scala/ldbc/query/builder/QuerySyntaxTest.scala b/module/ldbc-query-builder/src/test/scala/ldbc/query/builder/QuerySyntaxTest.scala index b094ae011..63ab54188 100644 --- a/module/ldbc-query-builder/src/test/scala/ldbc/query/builder/QuerySyntaxTest.scala +++ b/module/ldbc-query-builder/src/test/scala/ldbc/query/builder/QuerySyntaxTest.scala @@ -45,7 +45,7 @@ class QuerySyntaxTest extends AnyFlatSpec: assertCompiles( """ |import cats.effect.IO - |import ldbc.dsl.Executor + |import ldbc.dsl.DBIO |import ldbc.query.builder.Table |import ldbc.query.builder.syntax.io.* | 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 ca1484233..9c116de61 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 @@ -39,8 +39,8 @@ package object syntax: case _ => DslQuery.Impl[F, P](query.statement, query.params, Decoder.derivedProduct(m1)) extension (command: Command) - def update: Executor[F, Int] = - Executor.Impl[F, Int]( + def update: DBIO[F, Int] = + DBIO.Impl[F, Int]( command.statement, command.params, connection => @@ -52,10 +52,10 @@ package object syntax: yield result ) - def returning[T <: String | Int | Long](using decoder: Decoder.Elem[T]): Executor[F, T] = + def returning[T <: String | Int | Long](using decoder: Decoder.Elem[T]): DBIO[F, T] = given Decoder[T] = Decoder.one[T] - Executor.Impl[F, T]( + DBIO.Impl[F, T]( command.statement, command.params, connection => diff --git a/module/ldbc-statement/src/main/scala/ldbc/statement/syntax/CommandSyntax.scala b/module/ldbc-statement/src/main/scala/ldbc/statement/syntax/CommandSyntax.scala index b23fbe91c..ec2387a37 100644 --- a/module/ldbc-statement/src/main/scala/ldbc/statement/syntax/CommandSyntax.scala +++ b/module/ldbc-statement/src/main/scala/ldbc/statement/syntax/CommandSyntax.scala @@ -27,7 +27,7 @@ trait CommandSyntax[F[_]]: * @return * The number of rows updated */ - def update: Executor[F, Int] + def update: DBIO[F, Int] /** * A method to execute an insert operation against the MySQL server. @@ -44,4 +44,4 @@ trait CommandSyntax[F[_]]: * @return * The primary key value */ - def returning[T <: String | Int | Long](using decoder: Decoder.Elem[T]): Executor[F, T] + def returning[T <: String | Int | Long](using decoder: Decoder.Elem[T]): DBIO[F, T] diff --git a/tests/src/test/scala/ldbc/tests/ExecutorTest.scala b/tests/src/test/scala/ldbc/tests/ExecutorTest.scala index 3b1bf1628..93b7c350e 100644 --- a/tests/src/test/scala/ldbc/tests/ExecutorTest.scala +++ b/tests/src/test/scala/ldbc/tests/ExecutorTest.scala @@ -17,7 +17,7 @@ import org.typelevel.otel4s.trace.Tracer import ldbc.connector.* import ldbc.dsl.io.* -class ExecutorTest extends CatsEffectSuite: +class DBIOTest extends CatsEffectSuite: given Tracer[IO] = Tracer.noop[IO] @@ -29,8 +29,8 @@ class ExecutorTest extends CatsEffectSuite: ssl = SSL.Trusted ) - test("Executor#pure") { - val program = Executor.pure[IO, Int](1) + test("DBIO#pure") { + val program = DBIO.pure[IO, Int](1) assertIO( connection.use { conn => program.execute(conn) @@ -39,9 +39,9 @@ class ExecutorTest extends CatsEffectSuite: ) } - test("Executor#ap") { - val program1 = Executor.pure[IO, Int](1) - val program2 = Executor.pure[IO, Int => Int](_ + 1) + test("DBIO#ap") { + val program1 = DBIO.pure[IO, Int](1) + val program2 = DBIO.pure[IO, Int => Int](_ + 1) val program3 = program2.ap(program1) assertIO( connection.use { conn => @@ -51,8 +51,8 @@ class ExecutorTest extends CatsEffectSuite: ) } - test("Executor#map") { - val program1 = Executor.pure[IO, Int](1) + test("DBIO#map") { + val program1 = DBIO.pure[IO, Int](1) val program2 = program1.map(_ + 1) assertIO( connection.use { conn => @@ -62,9 +62,9 @@ class ExecutorTest extends CatsEffectSuite: ) } - test("Executor#flatMap") { - val program1 = Executor.pure[IO, Int](1) - val program2 = program1.flatMap(n => Executor.pure[IO, Int](n + 1)) + test("DBIO#flatMap") { + val program1 = DBIO.pure[IO, Int](1) + val program2 = program1.flatMap(n => DBIO.pure[IO, Int](n + 1)) assertIO( connection.use { conn => program2.execute(conn) @@ -73,9 +73,9 @@ class ExecutorTest extends CatsEffectSuite: ) } - test("Executor#tailRecM") { - val program1 = Executor.pure[IO, Int](1) - val program2 = program1.tailRecM[ExecutorIO, String](_.map(n => Right(n.toString))) + test("DBIO#tailRecM") { + val program1 = DBIO.pure[IO, Int](1) + val program2 = program1.tailRecM[DBIO, String](_.map(n => Right(n.toString))) assertIO( connection.use { conn => program2.execute(conn) @@ -84,8 +84,8 @@ class ExecutorTest extends CatsEffectSuite: ) } - test("Executor#raiseError") { - val program = Executor.raiseError[IO, Int](new Exception("error")) + test("DBIO#raiseError") { + val program = DBIO.raiseError[IO, Int](new Exception("error")) interceptMessageIO[Exception]("error")( connection.use { conn => program.execute(conn) @@ -93,9 +93,9 @@ class ExecutorTest extends CatsEffectSuite: ) } - test("Executor#handleErrorWith") { - val program1 = Executor.raiseError[IO, Int](new Exception("error")) - val program2 = program1.handleErrorWith(e => Executor.pure[IO, Int](0)) + test("DBIO#handleErrorWith") { + val program1 = DBIO.raiseError[IO, Int](new Exception("error")) + val program2 = program1.handleErrorWith(e => DBIO.pure[IO, Int](0)) assertIO( connection.use { conn => program2.execute(conn) @@ -104,8 +104,8 @@ class ExecutorTest extends CatsEffectSuite: ) } - test("Executor#attempt#Right") { - val program = Executor.pure[IO, Int](1) + test("DBIO#attempt#Right") { + val program = DBIO.pure[IO, Int](1) assertIO( connection.use { conn => program.attempt.execute(conn) @@ -114,8 +114,8 @@ class ExecutorTest extends CatsEffectSuite: ) } - test("Executor#attempt#Left") { - val program: Executor[IO, Int] = Executor.raiseError[IO, Int](new Exception("error")) + test("DBIO#attempt#Left") { + val program: DBIO[IO, Int] = DBIO.raiseError[IO, Int](new Exception("error")) assertIOBoolean( connection.use { conn => program.attempt.execute(conn).map(_.isLeft) diff --git a/tests/src/test/scala/ldbc/tests/TableQuerySelectConnectionTest.scala b/tests/src/test/scala/ldbc/tests/TableQuerySelectConnectionTest.scala index 1c851f847..109060517 100644 --- a/tests/src/test/scala/ldbc/tests/TableQuerySelectConnectionTest.scala +++ b/tests/src/test/scala/ldbc/tests/TableQuerySelectConnectionTest.scala @@ -313,7 +313,7 @@ trait TableQuerySelectConnectionTest extends CatsEffectSuite: (for codeOpt <- country.select(_.code).where(_.code _equals "JPN").query.to[Option] cities <- codeOpt match - case None => Executor.pure[IO, List[(String, String)]](List.empty) + case None => DBIO.pure[IO, List[(String, String)]](List.empty) case Some(code) => city .select(v => v.name *: v.countryCode) diff --git a/tests/src/test/scala/ldbc/tests/TableQueryUpdateConnectionTest.scala b/tests/src/test/scala/ldbc/tests/TableQueryUpdateConnectionTest.scala index ec42ef2d5..1e6db46b3 100644 --- a/tests/src/test/scala/ldbc/tests/TableQueryUpdateConnectionTest.scala +++ b/tests/src/test/scala/ldbc/tests/TableQueryUpdateConnectionTest.scala @@ -282,7 +282,7 @@ trait TableQueryUpdateConnectionTest extends CatsEffectSuite: cityOpt <- city.selectAll.where(_.countryCode _equals "JPN").and(_.name _equals "Tokyo").query.to[Option] result <- cityOpt match - case None => Executor.pure[IO, Int](0) + case None => DBIO.pure[IO, Int](0) case Some(cityModel) => city .update(cityModel.copy(district = "Tokyo-to")) @@ -431,7 +431,7 @@ trait TableQueryUpdateConnectionTest extends CatsEffectSuite: .query .to[Option] result <- codeOpt match - case None => Executor.pure[IO, Int](0) + case None => DBIO.pure[IO, Int](0) case Some(code) => city .update(c => c.name *: c.district *: c.population)(("update New York", "TT", 2)) diff --git a/tests/src/test/scala/ldbc/tests/TableSchemaSelectConnectionTest.scala b/tests/src/test/scala/ldbc/tests/TableSchemaSelectConnectionTest.scala index b77a0f15a..383e64404 100644 --- a/tests/src/test/scala/ldbc/tests/TableSchemaSelectConnectionTest.scala +++ b/tests/src/test/scala/ldbc/tests/TableSchemaSelectConnectionTest.scala @@ -314,7 +314,7 @@ trait TableSchemaSelectConnectionTest extends CatsEffectSuite: (for codeOpt <- country.select(_.code).where(_.code _equals "JPN").query.to[Option] cities <- codeOpt match - case None => Executor.pure[IO, List[(String, String)]](List.empty) + case None => DBIO.pure[IO, List[(String, String)]](List.empty) case Some(code) => city .select(v => v.name *: v.countryCode) From 704060decddbe04c109d03a566ad29433048d64f Mon Sep 17 00:00:00 2001 From: takapi327 Date: Tue, 24 Dec 2024 21:00:39 +0900 Subject: [PATCH 2/8] Action sbt scalafmtAll --- module/ldbc-dsl/src/main/scala/ldbc/dsl/package.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/ldbc-dsl/src/main/scala/ldbc/dsl/package.scala b/module/ldbc-dsl/src/main/scala/ldbc/dsl/package.scala index d0962b8cd..b63bf8b5c 100644 --- a/module/ldbc-dsl/src/main/scala/ldbc/dsl/package.scala +++ b/module/ldbc-dsl/src/main/scala/ldbc/dsl/package.scala @@ -190,7 +190,7 @@ package object dsl: def orderByOpt(s1: Option[SQL], s2: Option[SQL], ss: Option[SQL]*): Mysql[F] = orderByOpt((s1 :: s2 :: ss.toList).flatten) - //type DBIO[T] = ldbc.dsl.DBIO[F, T] + // type DBIO[T] = ldbc.dsl.DBIO[F, T] export ldbc.dsl.DBIO export ldbc.dsl.logging.LogHandler From 4fdefc4d38f7d023267a6730651700097d4dcf67 Mon Sep 17 00:00:00 2001 From: takapi327 Date: Tue, 24 Dec 2024 21:10:53 +0900 Subject: [PATCH 3/8] Fixed TableSchemaUpdateConnectionTest rename Executor to DBIO --- .../scala/ldbc/tests/TableSchemaUpdateConnectionTest.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/src/test/scala/ldbc/tests/TableSchemaUpdateConnectionTest.scala b/tests/src/test/scala/ldbc/tests/TableSchemaUpdateConnectionTest.scala index 735fad35b..673116ac3 100644 --- a/tests/src/test/scala/ldbc/tests/TableSchemaUpdateConnectionTest.scala +++ b/tests/src/test/scala/ldbc/tests/TableSchemaUpdateConnectionTest.scala @@ -282,7 +282,7 @@ trait TableSchemaUpdateConnectionTest extends CatsEffectSuite: cityOpt <- city.selectAll.where(_.countryCode _equals "JPN").and(_.name _equals "Tokyo").query.to[Option] result <- cityOpt match - case None => Executor.pure[IO, Int](0) + case None => DBIO.pure[IO, Int](0) case Some(cityModel) => city .update(cityModel.copy(district = "Tokyo-to")) @@ -431,7 +431,7 @@ trait TableSchemaUpdateConnectionTest extends CatsEffectSuite: .query .to[Option] result <- codeOpt match - case None => Executor.pure[IO, Int](0) + case None => DBIO.pure[IO, Int](0) case Some(code) => city .update(c => c.name *: c.district *: c.population)(("update New York", "TT", 2)) From a1f900fb5f02e6405eb516303aa7ad539b3f82b8 Mon Sep 17 00:00:00 2001 From: takapi327 Date: Tue, 24 Dec 2024 21:14:07 +0900 Subject: [PATCH 4/8] Added DBIO alias type --- .../src/main/scala/ldbc/dsl/package.scala | 3 +-- .../ldbc/query/builder/syntax/package.scala | 4 +-- .../ldbc/query/builder/QuerySyntaxTest.scala | 25 ++++++------------- .../scala/ldbc/schema/syntax/package.scala | 4 +-- 4 files changed, 13 insertions(+), 23 deletions(-) diff --git a/module/ldbc-dsl/src/main/scala/ldbc/dsl/package.scala b/module/ldbc-dsl/src/main/scala/ldbc/dsl/package.scala index b63bf8b5c..74969f7da 100644 --- a/module/ldbc-dsl/src/main/scala/ldbc/dsl/package.scala +++ b/module/ldbc-dsl/src/main/scala/ldbc/dsl/package.scala @@ -190,8 +190,7 @@ package object dsl: def orderByOpt(s1: Option[SQL], s2: Option[SQL], ss: Option[SQL]*): Mysql[F] = orderByOpt((s1 :: s2 :: ss.toList).flatten) - // type DBIO[T] = ldbc.dsl.DBIO[F, T] - export ldbc.dsl.DBIO + type DBIO[T] = ldbc.dsl.DBIO[F, T] export ldbc.dsl.logging.LogHandler 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 99ff2f0ea..fea69638e 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 @@ -42,7 +42,7 @@ package object syntax: case _ => DslQuery.Impl[F, P](query.statement, query.params, Decoder.derivedProduct(m1)) extension (command: Command) - def update: DBIO[F, Int] = + def update: DBIO[Int] = DBIO.Impl[F, Int]( command.statement, command.params, @@ -55,7 +55,7 @@ package object syntax: yield result ) - def returning[T <: String | Int | Long](using decoder: Decoder.Elem[T]): DBIO[F, T] = + def returning[T <: String | Int | Long](using decoder: Decoder.Elem[T]): DBIO[T] = given Decoder[T] = Decoder.one[T] DBIO.Impl[F, T]( diff --git a/module/ldbc-query-builder/src/test/scala/ldbc/query/builder/QuerySyntaxTest.scala b/module/ldbc-query-builder/src/test/scala/ldbc/query/builder/QuerySyntaxTest.scala index 63ab54188..2a33aa327 100644 --- a/module/ldbc-query-builder/src/test/scala/ldbc/query/builder/QuerySyntaxTest.scala +++ b/module/ldbc-query-builder/src/test/scala/ldbc/query/builder/QuerySyntaxTest.scala @@ -45,7 +45,6 @@ class QuerySyntaxTest extends AnyFlatSpec: assertCompiles( """ |import cats.effect.IO - |import ldbc.dsl.DBIO |import ldbc.query.builder.Table |import ldbc.query.builder.syntax.io.* | @@ -53,7 +52,7 @@ class QuerySyntaxTest extends AnyFlatSpec: | |val user = TableQuery[User] | - |val query: Executor[IO, List[User]] = user.selectAll.query.to[List] + |val query: DBIO[List[User]] = user.selectAll.query.to[List] |""".stripMargin ) } @@ -94,7 +93,6 @@ class QuerySyntaxTest extends AnyFlatSpec: """ |import cats.effect.IO | - |import ldbc.dsl.Executor |import ldbc.query.builder.Table |import ldbc.query.builder.syntax.io.* | @@ -102,7 +100,7 @@ class QuerySyntaxTest extends AnyFlatSpec: | |val user = TableQuery[User] | - |val query: Executor[IO, Option[User]] = user.selectAll.where(_.id === 1).query.to[Option] + |val query: DBIO[Option[User]] = user.selectAll.where(_.id === 1).query.to[Option] |""".stripMargin ) } @@ -112,7 +110,6 @@ class QuerySyntaxTest extends AnyFlatSpec: """ |import cats.effect.IO | - |import ldbc.dsl.Executor |import ldbc.query.builder.Table |import ldbc.query.builder.syntax.io.* | @@ -120,7 +117,7 @@ class QuerySyntaxTest extends AnyFlatSpec: | |val user = TableQuery[User] | - |val query: Executor[IO, User] = user.selectAll.where(_.id === 1).query.unsafe + |val query: DBIO[User] = user.selectAll.where(_.id === 1).query.unsafe |""".stripMargin ) } @@ -146,7 +143,6 @@ class QuerySyntaxTest extends AnyFlatSpec: """ |import cats.effect.IO | - |import ldbc.dsl.Executor |import ldbc.query.builder.Table |import ldbc.query.builder.syntax.io.* | @@ -154,7 +150,7 @@ class QuerySyntaxTest extends AnyFlatSpec: | |val user = TableQuery[User] | - |val query: Executor[IO, User] = user.selectAll.where(_.id === 1).query.unsafe + |val query: DBIO[User] = user.selectAll.where(_.id === 1).query.unsafe |""".stripMargin ) } @@ -164,7 +160,6 @@ class QuerySyntaxTest extends AnyFlatSpec: """ |import cats.effect.IO | - |import ldbc.dsl.Executor |import ldbc.query.builder.Table |import ldbc.query.builder.syntax.io.* | @@ -177,7 +172,7 @@ class QuerySyntaxTest extends AnyFlatSpec: | |case class UserCategory(userName: String, categoryName: String) | - |val query: Executor[IO, List[(String, String)]] = (user join category).on((user, category) => user.categoryId === category.id) + |val query: DBIO[List[(String, String)]] = (user join category).on((user, category) => user.categoryId === category.id) | .select((user, category) => user.name *: category.name) | .query | .to[List] @@ -190,7 +185,6 @@ class QuerySyntaxTest extends AnyFlatSpec: """ |import cats.effect.IO | - |import ldbc.dsl.Executor |import ldbc.query.builder.Table |import ldbc.query.builder.syntax.io.* | @@ -216,7 +210,6 @@ class QuerySyntaxTest extends AnyFlatSpec: """ |import cats.effect.IO | - |import ldbc.dsl.Executor |import ldbc.query.builder.Table |import ldbc.query.builder.syntax.io.* | @@ -233,7 +226,7 @@ class QuerySyntaxTest extends AnyFlatSpec: |val cityQuery = TableQuery[City] |val countryLanguageQuery = TableQuery[CountryLanguage] | - |val query: Executor[IO, List[(String, String, Option[String])]] = (countryQuery join cityQuery).on((country, city) => country.code === city.countryCode) + |val query: DBIO[List[(String, String, Option[String])]] = (countryQuery join cityQuery).on((country, city) => country.code === city.countryCode) | .leftJoin(countryLanguageQuery).on((_, city, countryLanguage) => city.countryCode === countryLanguage.countryCode) | .select((country, city, countryLanguage) => country.name *: city.name *: countryLanguage.language) | .query @@ -247,7 +240,6 @@ class QuerySyntaxTest extends AnyFlatSpec: """ |import cats.effect.IO | - |import ldbc.dsl.Executor |import ldbc.query.builder.Table |import ldbc.query.builder.syntax.io.* | @@ -264,7 +256,7 @@ class QuerySyntaxTest extends AnyFlatSpec: |val cityQuery = TableQuery[City] |val countryLanguageQuery = TableQuery[CountryLanguage] | - |val query: Executor[IO, List[(Option[String], Option[String], String)]] = (countryQuery join cityQuery).on((country, city) => country.code === city.countryCode) + |val query: DBIO[List[(Option[String], Option[String], String)]] = (countryQuery join cityQuery).on((country, city) => country.code === city.countryCode) | .rightJoin(countryLanguageQuery).on((_, city, countryLanguage) => city.countryCode === countryLanguage.countryCode) | .select((country, city, countryLanguage) => country.name *: city.name *: countryLanguage.language) | .query @@ -278,7 +270,6 @@ class QuerySyntaxTest extends AnyFlatSpec: """ |import cats.effect.IO | - |import ldbc.dsl.Executor |import ldbc.query.builder.Table |import ldbc.query.builder.syntax.io.* | @@ -295,7 +286,7 @@ class QuerySyntaxTest extends AnyFlatSpec: |val cityQuery = TableQuery[City] |val countryLanguageQuery = TableQuery[CountryLanguage] | - |val query: Executor[IO, List[(String, String, Option[String])]] = (countryQuery join cityQuery).on((country, city) => country.code === city.countryCode) + |val query: DBIO[List[(String, String, Option[String])]] = (countryQuery join cityQuery).on((country, city) => country.code === city.countryCode) | .leftJoin(countryLanguageQuery).on((_, city, countryLanguage) => city.countryCode === countryLanguage.countryCode) | .select((country, city, countryLanguage) => country.name *: city.name *: countryLanguage.language) | .query 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 9c116de61..dd80b737c 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 @@ -39,7 +39,7 @@ package object syntax: case _ => DslQuery.Impl[F, P](query.statement, query.params, Decoder.derivedProduct(m1)) extension (command: Command) - def update: DBIO[F, Int] = + def update: DBIO[Int] = DBIO.Impl[F, Int]( command.statement, command.params, @@ -52,7 +52,7 @@ package object syntax: yield result ) - def returning[T <: String | Int | Long](using decoder: Decoder.Elem[T]): DBIO[F, T] = + def returning[T <: String | Int | Long](using decoder: Decoder.Elem[T]): DBIO[T] = given Decoder[T] = Decoder.one[T] DBIO.Impl[F, T]( From 2c8318fb09aa57569ecf932d28d2ce7e8a66640b Mon Sep 17 00:00:00 2001 From: takapi327 Date: Tue, 24 Dec 2024 21:16:51 +0900 Subject: [PATCH 5/8] Change use DBIO alias type --- docs/src/main/scala/00-Setup.scala | 14 +++++++------- docs/src/main/scala/01-Program.scala | 2 +- docs/src/main/scala/03-Program.scala | 2 +- docs/src/main/scala/04-Program.scala | 2 +- docs/src/main/scala/05-Program.scala | 4 ++-- docs/src/main/scala/0X-Cleanup.scala | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/src/main/scala/00-Setup.scala b/docs/src/main/scala/00-Setup.scala index b0e775ef3..81d2dfc81 100644 --- a/docs/src/main/scala/00-Setup.scala +++ b/docs/src/main/scala/00-Setup.scala @@ -22,12 +22,12 @@ import ldbc.dsl.io.* // #given // #setupDatabase - val createDatabase: DBIO[IO, Int] = + val createDatabase: DBIO[Int] = sql"CREATE DATABASE IF NOT EXISTS sandbox_db".update // #setupDatabase // #setupUser - val createUser: DBIO[IO, Int] = + val createUser: DBIO[Int] = sql""" CREATE TABLE IF NOT EXISTS `user` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -40,7 +40,7 @@ import ldbc.dsl.io.* // #setupUser // #setupProduct - val createProduct: DBIO[IO, Int] = + val createProduct: DBIO[Int] = sql""" CREATE TABLE IF NOT EXISTS `product` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -53,7 +53,7 @@ import ldbc.dsl.io.* // #setupProduct // #setupOrder - val createOrder: DBIO[IO, Int] = + val createOrder: DBIO[Int] = sql""" CREATE TABLE IF NOT EXISTS `order` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -70,7 +70,7 @@ import ldbc.dsl.io.* // #setupOrder // #insertUser - val insertUser: DBIO[IO, Int] = + val insertUser: DBIO[Int] = sql""" INSERT INTO user (name, email) VALUES ('Alice', 'alice@example.com'), @@ -80,7 +80,7 @@ import ldbc.dsl.io.* // #insertUser // #insertProduct - val insertProduct: DBIO[IO, Int] = + val insertProduct: DBIO[Int] = sql""" INSERT INTO product (name, price) VALUES ('Laptop', 999.99), @@ -91,7 +91,7 @@ import ldbc.dsl.io.* // #insertProduct // #insertOrder - val insertOrder: DBIO[IO, Int] = + val insertOrder: DBIO[Int] = sql""" INSERT INTO `order` (user_id, product_id, quantity) VALUES (1, 1, 1), -- Alice ordered 1 Laptop diff --git a/docs/src/main/scala/01-Program.scala b/docs/src/main/scala/01-Program.scala index 0143fb175..c8bd2c198 100644 --- a/docs/src/main/scala/01-Program.scala +++ b/docs/src/main/scala/01-Program.scala @@ -19,7 +19,7 @@ import ldbc.dsl.io.* // #given // #program - val program: DBIO[IO, Int] = DBIO.pure[IO, Int](1) + val program: DBIO[Int] = DBIO.pure[IO, Int](1) // #program // #connection diff --git a/docs/src/main/scala/03-Program.scala b/docs/src/main/scala/03-Program.scala index 9793d4128..0e5f9ca39 100644 --- a/docs/src/main/scala/03-Program.scala +++ b/docs/src/main/scala/03-Program.scala @@ -22,7 +22,7 @@ import ldbc.dsl.io.* // #given // #program - val program: DBIO[IO, (List[Int], Option[Int], Int)] = + val program: DBIO[(List[Int], Option[Int], Int)] = for result1 <- sql"SELECT 1".query[Int].to[List] result2 <- sql"SELECT 2".query[Int].to[Option] diff --git a/docs/src/main/scala/04-Program.scala b/docs/src/main/scala/04-Program.scala index af4bdc1b9..0e2c66ef4 100644 --- a/docs/src/main/scala/04-Program.scala +++ b/docs/src/main/scala/04-Program.scala @@ -20,7 +20,7 @@ import ldbc.dsl.io.* // #given // #program - val program: DBIO[IO, Int] = + val program: DBIO[Int] = sql"INSERT INTO user (name, email) VALUES ('Carol', 'carol@example.com')".update // #program diff --git a/docs/src/main/scala/05-Program.scala b/docs/src/main/scala/05-Program.scala index 009e2dfdc..9b85beab6 100644 --- a/docs/src/main/scala/05-Program.scala +++ b/docs/src/main/scala/05-Program.scala @@ -28,7 +28,7 @@ import ldbc.dsl.codec.* case Status.Active => true case Status.InActive => false - val program1: DBIO[IO, Int] = + val program1: DBIO[Int] = sql"INSERT INTO user (name, email, status) VALUES (${ "user 1" }, ${ "user@example.com" }, ${ Status.Active })".update given Decoder.Elem[Status] = Decoder.Elem.mapping[Boolean, Status] { @@ -36,7 +36,7 @@ import ldbc.dsl.codec.* case false => Status.InActive } - val program2: DBIO[IO, (String, String, Status)] = + val program2: DBIO[(String, String, Status)] = sql"SELECT name, email, status FROM user WHERE id = 1".query[(String, String, Status)].unsafe def connection = Connection[IO]( diff --git a/docs/src/main/scala/0X-Cleanup.scala b/docs/src/main/scala/0X-Cleanup.scala index e73356408..b508b3bd0 100644 --- a/docs/src/main/scala/0X-Cleanup.scala +++ b/docs/src/main/scala/0X-Cleanup.scala @@ -20,7 +20,7 @@ import ldbc.dsl.io.* // #given // #cleanupDatabase - val dropDatabase: DBIO[IO, Int] = + val dropDatabase: DBIO[Int] = sql"DROP DATABASE IF EXISTS sandbox_db".update // #cleanupDatabase From 1ebc640a34edaad7b79e23ce15933504304cb4a2 Mon Sep 17 00:00:00 2001 From: takapi327 Date: Tue, 24 Dec 2024 21:24:02 +0900 Subject: [PATCH 6/8] Fixed DBIO export variables --- module/ldbc-dsl/src/main/scala/ldbc/dsl/package.scala | 1 + tests/src/test/scala/ldbc/tests/ExecutorTest.scala | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/module/ldbc-dsl/src/main/scala/ldbc/dsl/package.scala b/module/ldbc-dsl/src/main/scala/ldbc/dsl/package.scala index 74969f7da..7295b27d2 100644 --- a/module/ldbc-dsl/src/main/scala/ldbc/dsl/package.scala +++ b/module/ldbc-dsl/src/main/scala/ldbc/dsl/package.scala @@ -191,6 +191,7 @@ package object dsl: orderByOpt((s1 :: s2 :: ss.toList).flatten) type DBIO[T] = ldbc.dsl.DBIO[F, T] + val DBIO = ldbc.dsl.DBIO export ldbc.dsl.logging.LogHandler diff --git a/tests/src/test/scala/ldbc/tests/ExecutorTest.scala b/tests/src/test/scala/ldbc/tests/ExecutorTest.scala index 93b7c350e..8787faffb 100644 --- a/tests/src/test/scala/ldbc/tests/ExecutorTest.scala +++ b/tests/src/test/scala/ldbc/tests/ExecutorTest.scala @@ -115,7 +115,7 @@ class DBIOTest extends CatsEffectSuite: } test("DBIO#attempt#Left") { - val program: DBIO[IO, Int] = DBIO.raiseError[IO, Int](new Exception("error")) + val program: DBIO[Int] = DBIO.raiseError[IO, Int](new Exception("error")) assertIOBoolean( connection.use { conn => program.attempt.execute(conn).map(_.isLeft) From 11ccc0b0ff06030e3f814d42d5d948459df9883e Mon Sep 17 00:00:00 2001 From: takapi327 Date: Tue, 24 Dec 2024 21:35:44 +0900 Subject: [PATCH 7/8] Fixed compile error --- docs/src/main/scala/02-Program.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/main/scala/02-Program.scala b/docs/src/main/scala/02-Program.scala index 28325f594..fae17c198 100644 --- a/docs/src/main/scala/02-Program.scala +++ b/docs/src/main/scala/02-Program.scala @@ -20,7 +20,7 @@ import ldbc.dsl.io.* // #given // #program - val program: DBIO[IO, Option[Int]] = sql"SELECT 2".query[Int].to[Option] + val program: DBIO[Option[Int]] = sql"SELECT 2".query[Int].to[Option] // #program // #connection From 89526df41f1f32e8a84e1874df2958911570b54b Mon Sep 17 00:00:00 2001 From: takapi327 Date: Tue, 24 Dec 2024 21:42:29 +0900 Subject: [PATCH 8/8] Rename file Executor -> DBIO --- .../src/main/scala/ldbc/dsl/{Executor.scala => DBIO.scala} | 0 .../test/scala/ldbc/tests/{ExecutorTest.scala => DBIOTest.scala} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename module/ldbc-dsl/src/main/scala/ldbc/dsl/{Executor.scala => DBIO.scala} (100%) rename tests/src/test/scala/ldbc/tests/{ExecutorTest.scala => DBIOTest.scala} (100%) diff --git a/module/ldbc-dsl/src/main/scala/ldbc/dsl/Executor.scala b/module/ldbc-dsl/src/main/scala/ldbc/dsl/DBIO.scala similarity index 100% rename from module/ldbc-dsl/src/main/scala/ldbc/dsl/Executor.scala rename to module/ldbc-dsl/src/main/scala/ldbc/dsl/DBIO.scala diff --git a/tests/src/test/scala/ldbc/tests/ExecutorTest.scala b/tests/src/test/scala/ldbc/tests/DBIOTest.scala similarity index 100% rename from tests/src/test/scala/ldbc/tests/ExecutorTest.scala rename to tests/src/test/scala/ldbc/tests/DBIOTest.scala