From 3d906d770d8527a62154f330788116a1a58c9ba4 Mon Sep 17 00:00:00 2001 From: takapi327 Date: Mon, 30 Oct 2023 22:50:26 +0900 Subject: [PATCH] Action sbt scalafmtAll --- core/src/main/scala/ldbc/core/Alias.scala | 5 +++-- core/src/main/scala/ldbc/core/Key.scala | 3 ++- core/src/main/scala/ldbc/core/Table.scala | 9 ++++----- .../src/main/scala/ldbc/core/interpreter/Tuples.scala | 11 +++++------ core/src/test/scala/ldbc/core/TableTest.scala | 9 +++------ 5 files changed, 17 insertions(+), 20 deletions(-) diff --git a/core/src/main/scala/ldbc/core/Alias.scala b/core/src/main/scala/ldbc/core/Alias.scala index 25303c26f..02457e117 100644 --- a/core/src/main/scala/ldbc/core/Alias.scala +++ b/core/src/main/scala/ldbc/core/Alias.scala @@ -168,7 +168,8 @@ private[ldbc] trait Alias: name: String, column: Column[T], reference: Reference[Column[T] *: EmptyTuple] - ): ForeignKey[Column[T] *: EmptyTuple] = ForeignKey[Column[T] *: EmptyTuple](Some(name), column *: EmptyTuple, reference) + ): ForeignKey[Column[T] *: EmptyTuple] = + ForeignKey[Column[T] *: EmptyTuple](Some(name), column *: EmptyTuple, reference) def FOREIGN_KEY[T <: Tuple]( columns: T, @@ -196,7 +197,7 @@ private[ldbc] trait Alias: ): Reference[Column[T] *: EmptyTuple] = Reference[Column[T] *: EmptyTuple](table, column *: EmptyTuple, None, None) def REFERENCE[T <: Tuple]( - table: Table[?], + table: Table[?], columns: T )(using Tuples.IsColumn[T] =:= true): Reference[T] = Reference[T](table, columns, None, None) diff --git a/core/src/main/scala/ldbc/core/Key.scala b/core/src/main/scala/ldbc/core/Key.scala index 14ecd9b3b..3e7892073 100644 --- a/core/src/main/scala/ldbc/core/Key.scala +++ b/core/src/main/scala/ldbc/core/Key.scala @@ -196,7 +196,8 @@ private[ldbc] case class ForeignKey[T <: Tuple]( indexName: Option[String], columns: T, reference: Reference[T] -)(using Tuples.IsColumn[T] =:= true) extends Key: +)(using Tuples.IsColumn[T] =:= true) + extends Key: override val label: String = "FOREIGN KEY" diff --git a/core/src/main/scala/ldbc/core/Table.scala b/core/src/main/scala/ldbc/core/Table.scala index 0f9b63ec3..cee366f0f 100644 --- a/core/src/main/scala/ldbc/core/Table.scala +++ b/core/src/main/scala/ldbc/core/Table.scala @@ -79,15 +79,14 @@ private[ldbc] trait Table[P <: Product] extends Dynamic: object Table extends Dynamic: - extension[P <: Product](table: Table[P]) - + extension [P <: Product](table: Table[P]) /** Methods for statically accessing column information held by a Table. - */ + */ transparent inline def selectDynamic[Tag <: Singleton]( tag: Tag )(using mirror: Mirror.ProductOf[P], - index: ValueOf[Tuples.IndexOf[mirror.MirroredElemLabels, Tag]] + index: ValueOf[Tuples.IndexOf[mirror.MirroredElemLabels, Tag]] ): Column[Tuple.Elem[mirror.MirroredElemTypes, Tuples.IndexOf[mirror.MirroredElemLabels, Tag]]] = val column = table.columns .productElement(index.value) @@ -157,6 +156,6 @@ object Table extends Dynamic: private def fromTupleMap[P <: Product](using mirror: Mirror.ProductOf[P] )( - name: String, + name: String, columns: Tuple.Map[mirror.MirroredElemTypes, Column] ): Table[P] = Impl[P, mirror.MirroredElemTypes](name, columns, Seq.empty, Seq.empty, None) diff --git a/core/src/main/scala/ldbc/core/interpreter/Tuples.scala b/core/src/main/scala/ldbc/core/interpreter/Tuples.scala index 7bfd9214e..f1db8d199 100644 --- a/core/src/main/scala/ldbc/core/interpreter/Tuples.scala +++ b/core/src/main/scala/ldbc/core/interpreter/Tuples.scala @@ -18,11 +18,10 @@ object Tuples: case E *: _ => 0 case _ *: es => S[IndexOf[es, E]] - /** - * Type to verify that a tuple of a given type consists only of the type wrapped in Column. - */ + /** Type to verify that a tuple of a given type consists only of the type wrapped in Column. + */ type IsColumn[T <: Tuple] <: Boolean = T match - case EmptyTuple => false - case Column[t] => true + case EmptyTuple => false + case Column[t] => true case Column[t] *: EmptyTuple => true - case Column[t] *: ts => IsColumn[ts] + case Column[t] *: ts => IsColumn[ts] diff --git a/core/src/test/scala/ldbc/core/TableTest.scala b/core/src/test/scala/ldbc/core/TableTest.scala index 7599161fd..bf5fac905 100644 --- a/core/src/test/scala/ldbc/core/TableTest.scala +++ b/core/src/test/scala/ldbc/core/TableTest.scala @@ -65,8 +65,7 @@ class TableTest extends AnyFlatSpec: } it should "Foreign key constraints can be set between the same type without any problem." in { - assertCompiles( - """ + assertCompiles(""" import ldbc.core.* case class Test(id: Long, subId: Long) @@ -88,8 +87,7 @@ class TableTest extends AnyFlatSpec: } it should "Setting foreign key constraints between different types results in a compile error." in { - assertDoesNotCompile( - """ + assertDoesNotCompile(""" import ldbc.core.* case class Test(id: Long, subId: Long) @@ -111,8 +109,7 @@ class TableTest extends AnyFlatSpec: } it should "" in { - assertCompiles( - """ + assertCompiles(""" import ldbc.core.* case class Test(id: Long, subId: Long, subCategory: Short)