From 019cdd3ca640aa0ae3fb63f2e12cb4833daf4d4c Mon Sep 17 00:00:00 2001 From: takapi327 Date: Mon, 30 Dec 2024 18:53:04 +0900 Subject: [PATCH] Action sbt scalafmtAll --- .../main/scala/ldbc/dsl/codec/Decoder.scala | 10 ++--- .../main/scala/ldbc/dsl/codec/Encoder.scala | 4 +- .../ldbc/query/builder/syntax/package.scala | 8 ++-- .../main/scala/ldbc/schema/ColumnImpl.scala | 2 +- .../src/main/scala/ldbc/schema/Table.scala | 4 +- .../scala/ldbc/schema/syntax/package.scala | 8 ++-- .../main/scala/ldbc/statement/Column.scala | 38 +++++++++---------- .../ldbc/statement/syntax/QuerySyntax.scala | 8 ++-- 8 files changed, 41 insertions(+), 41 deletions(-) diff --git a/module/ldbc-dsl/src/main/scala/ldbc/dsl/codec/Decoder.scala b/module/ldbc-dsl/src/main/scala/ldbc/dsl/codec/Decoder.scala index 0d6c87aef..ee2559877 100644 --- a/module/ldbc-dsl/src/main/scala/ldbc/dsl/codec/Decoder.scala +++ b/module/ldbc-dsl/src/main/scala/ldbc/dsl/codec/Decoder.scala @@ -43,8 +43,8 @@ trait Decoder[A]: /** Map decoded results to a new type `B`, yielding a `Decoder[B]`. */ def map[B](f: A => B): Decoder[B] = new Decoder[B]: - override def offset: Int = self.offset - override def decode(resultSet: ResultSet, index: Int): B = f(self.decode(resultSet, index)) + override def offset: Int = self.offset + override def decode(resultSet: ResultSet, index: Int): B = f(self.decode(resultSet, index)) /** `Decoder` is semigroupal: a pair of decoders make a decoder for a pair. */ def product[B](fb: Decoder[B]): Decoder[(A, B)] = new Decoder[(A, B)]: @@ -68,8 +68,8 @@ object Decoder extends TwiddleSyntax[Decoder]: override def ap[A, B](fab: Decoder[A => B])(fa: Decoder[A]): Decoder[B] = map(fab.product(fa)) { case (fabb, a) => fabb(a) } override def pure[A](x: A): Decoder[A] = new Decoder[A]: - override def offset: Int = 0 - override def decode(resultSet: ResultSet, index: Int): A = x + override def offset: Int = 0 + override def decode(resultSet: ResultSet, index: Int): A = x given Decoder[String] = (resultSet: ResultSet, index: Int) => resultSet.getString(index) given Decoder[Boolean] = (resultSet: ResultSet, index: Int) => resultSet.getBoolean(index) @@ -101,6 +101,6 @@ object Decoder extends TwiddleSyntax[Decoder]: given [H, T <: Tuple](using dh: Decoder[H], dt: Decoder[T]): Decoder[H *: T] = dh.product(dt).map { case (h, t) => h *: t } - + given [P <: Product](using mirror: Mirror.ProductOf[P], decoder: Decoder[mirror.MirroredElemTypes]): Decoder[P] = decoder.to[P] diff --git a/module/ldbc-dsl/src/main/scala/ldbc/dsl/codec/Encoder.scala b/module/ldbc-dsl/src/main/scala/ldbc/dsl/codec/Encoder.scala index 75d58d48d..00dce470a 100644 --- a/module/ldbc-dsl/src/main/scala/ldbc/dsl/codec/Encoder.scala +++ b/module/ldbc-dsl/src/main/scala/ldbc/dsl/codec/Encoder.scala @@ -56,8 +56,8 @@ object Encoder extends TwiddleSyntax[Encoder]: def apply[A](using encoder: Encoder[A]): Encoder[A] = encoder given ContravariantSemigroupal[Encoder] with - override def contramap[A, B](fa: Encoder[A])(f: B => A): Encoder[B] = fa.contramap(f) - override def product[A, B](fa: Encoder[A], fb: Encoder[B]): Encoder[(A, B)] = fa.product(fb) + override def contramap[A, B](fa: Encoder[A])(f: B => A): Encoder[B] = fa.contramap(f) + override def product[A, B](fa: Encoder[A], fb: Encoder[B]): Encoder[(A, B)] = fa.product(fb) given Encoder[Boolean] with override def encode(value: Boolean): Encoded = 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 db9e45ca8..220be2ffe 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 @@ -32,10 +32,10 @@ package object syntax: def query: DslQuery[F, B] = DslQuery.Impl[F, B](query.statement, query.params, query.columns.decoder) def queryTo[P <: Product](using - m1: Mirror.ProductOf[P], - m2: Mirror.ProductOf[B], - check: m1.MirroredElemTypes =:= m2.MirroredElemTypes, - decoder: Decoder[P] + m1: Mirror.ProductOf[P], + m2: Mirror.ProductOf[B], + check: m1.MirroredElemTypes =:= m2.MirroredElemTypes, + decoder: Decoder[P] ): DslQuery[F, P] = DslQuery.Impl[F, P](query.statement, query.params, decoder) diff --git a/module/ldbc-schema/src/main/scala/ldbc/schema/ColumnImpl.scala b/module/ldbc-schema/src/main/scala/ldbc/schema/ColumnImpl.scala index 56d8882e7..3ba790b4d 100644 --- a/module/ldbc-schema/src/main/scala/ldbc/schema/ColumnImpl.scala +++ b/module/ldbc-schema/src/main/scala/ldbc/schema/ColumnImpl.scala @@ -20,7 +20,7 @@ private[ldbc] case class ColumnImpl[T]( ) extends Column[T]: override def as(name: String): Column[T] = - this.copy(alias = Some(name)) + this.copy(alias = Some(name)) override def statement: String = dataType.fold(s"`$name`")(dataType => s"`$name` ${ dataType.queryString }") + attributes diff --git a/module/ldbc-schema/src/main/scala/ldbc/schema/Table.scala b/module/ldbc-schema/src/main/scala/ldbc/schema/Table.scala index feb324eec..d64855ae1 100644 --- a/module/ldbc-schema/src/main/scala/ldbc/schema/Table.scala +++ b/module/ldbc-schema/src/main/scala/ldbc/schema/Table.scala @@ -22,13 +22,13 @@ trait Table[T](val $name: String) extends AbstractTable[T]: ColumnImpl[A](name, Some(s"${ $name }.$name"), decoder, encoder, None, List.empty) protected final def column[A](name: String, dataType: DataType[A])(using - decoder: Decoder[A], + decoder: Decoder[A], encoder: Encoder[A] ): Column[A] = ColumnImpl[A](name, Some(s"${ $name }.$name"), decoder, encoder, Some(dataType), List.empty) protected final def column[A](name: String, dataType: DataType[A], attributes: Attribute[A]*)(using - decoder: Decoder[A], + decoder: Decoder[A], encoder: Encoder[A] ): Column[A] = ColumnImpl[A](name, Some(s"${ $name }.$name"), decoder, encoder, Some(dataType), attributes.toList) 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 5b63e72a3..87b0415ad 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 @@ -29,10 +29,10 @@ package object syntax: def query: DslQuery[F, B] = DslQuery.Impl[F, B](query.statement, query.params, query.columns.decoder) def queryTo[P <: Product](using - m1: Mirror.ProductOf[P], - m2: Mirror.ProductOf[B], - check: m1.MirroredElemTypes =:= m2.MirroredElemTypes, - decoder: Decoder[P] + m1: Mirror.ProductOf[P], + m2: Mirror.ProductOf[B], + check: m1.MirroredElemTypes =:= m2.MirroredElemTypes, + decoder: Decoder[P] ): DslQuery[F, P] = DslQuery.Impl[F, P](query.statement, query.params, decoder) diff --git a/module/ldbc-statement/src/main/scala/ldbc/statement/Column.scala b/module/ldbc-statement/src/main/scala/ldbc/statement/Column.scala index f440021ad..fae44db95 100644 --- a/module/ldbc-statement/src/main/scala/ldbc/statement/Column.scala +++ b/module/ldbc-statement/src/main/scala/ldbc/statement/Column.scala @@ -70,11 +70,11 @@ trait Column[A]: def imap[B](f: A => B)(g: B => A): Column[B] = new Column[B]: - override def name: String = self.name - override def alias: Option[String] = self.alias - override def as(name: String): Column[B] = this - override def decoder: Decoder[B] = self.decoder.map(f) - override def encoder: Encoder[B] = (value: B) => self.encoder.encode(g(value)) + override def name: String = self.name + override def alias: Option[String] = self.alias + override def as(name: String): Column[B] = this + override def decoder: Decoder[B] = self.decoder.map(f) + override def encoder: Encoder[B] = (value: B) => self.encoder.encode(g(value)) override def updateStatement: String = self.updateStatement override def duplicateKeyUpdateStatement: String = self.duplicateKeyUpdateStatement override def values: Int = self.values @@ -685,8 +685,8 @@ object Column extends TwiddleSyntax[Column]: override def alias: Option[String] = None override def as(name: String): Column[A] = this override def decoder: Decoder[A] = new Decoder[A]: - override def offset: Int = 0 - override def decode(resultSet: ResultSet, index: Int): A = value + override def offset: Int = 0 + override def decode(resultSet: ResultSet, index: Int): A = value override def encoder: Encoder[A] = (value: A) => Encoder.Encoded.success(List.empty) override def insertStatement: String = "" override def updateStatement: String = "" @@ -746,23 +746,23 @@ object Column extends TwiddleSyntax[Column]: override def alias: Option[String] = Some( s"${ left.alias.getOrElse(left.name) } $flag ${ right.alias.getOrElse(right.name) }" ) - override def as(name: String): Column[A] = this - override def decoder: Decoder[A] = _decoder + override def as(name: String): Column[A] = this + override def decoder: Decoder[A] = _decoder override def encoder: Encoder[A] = _encoder override def insertStatement: String = "" override def updateStatement: String = "" override def duplicateKeyUpdateStatement: String = "" private[ldbc] case class Count(_name: String, _alias: Option[String])(using - _decoder: Decoder[Int], + _decoder: Decoder[Int], _encoder: Encoder[Int] ) extends Column[Int]: - override def name: String = s"COUNT($_name)" - override def alias: Option[String] = _alias.map(a => s"COUNT($a)") - override def as(name: String): Column[Int] = this.copy(s"$name.${ _name }") - override def decoder: Decoder[Int] = _decoder - override def encoder: Encoder[Int] = _encoder - override def toString: String = name - override def insertStatement: String = "" - override def updateStatement: String = "" - override def duplicateKeyUpdateStatement: String = "" + override def name: String = s"COUNT($_name)" + override def alias: Option[String] = _alias.map(a => s"COUNT($a)") + override def as(name: String): Column[Int] = this.copy(s"$name.${ _name }") + override def decoder: Decoder[Int] = _decoder + override def encoder: Encoder[Int] = _encoder + override def toString: String = name + override def insertStatement: String = "" + override def updateStatement: String = "" + override def duplicateKeyUpdateStatement: String = "" diff --git a/module/ldbc-statement/src/main/scala/ldbc/statement/syntax/QuerySyntax.scala b/module/ldbc-statement/src/main/scala/ldbc/statement/syntax/QuerySyntax.scala index 7661acebe..55723e62e 100644 --- a/module/ldbc-statement/src/main/scala/ldbc/statement/syntax/QuerySyntax.scala +++ b/module/ldbc-statement/src/main/scala/ldbc/statement/syntax/QuerySyntax.scala @@ -39,8 +39,8 @@ trait QuerySyntax[F[_]]: * A [[ldbc.dsl.Query]] instance */ def queryTo[P <: Product](using - m1: Mirror.ProductOf[P], - m2: Mirror.ProductOf[B], - check: m1.MirroredElemTypes =:= m2.MirroredElemTypes, - decoder: Decoder[P] + m1: Mirror.ProductOf[P], + m2: Mirror.ProductOf[B], + check: m1.MirroredElemTypes =:= m2.MirroredElemTypes, + decoder: Decoder[P] ): DslQuery[F, P]