From 85a47e7cb8b75f3b1a47ccb2c4d3eac3c3588400 Mon Sep 17 00:00:00 2001 From: sviezypan Date: Thu, 16 Feb 2023 20:07:52 +0100 Subject: [PATCH 1/5] re-architecture core module --- core/jvm/src/main/scala/zio/sql/Sql.scala | 39 +- .../src/main/scala/zio/sql/allcolumns.scala | 945 ------------------ core/jvm/src/main/scala/zio/sql/delete.scala | 8 - .../main/scala/zio/sql/delete/Delete.scala | 8 + core/jvm/src/main/scala/zio/sql/expr.scala | 515 ---------- .../scala/zio/sql/expr/AggregationDef.scala | 23 + .../scala/zio/sql/expr/ComparableTypes.scala | 39 + .../src/main/scala/zio/sql/expr/Expr.scala | 282 ++++++ .../main/scala/zio/sql/expr/FunctionDef.scala | 153 +++ .../scala/zio/sql/expr/FunctionName.scala | 3 + .../jvm/src/main/scala/zio/sql/expr/Set.scala | 33 + core/jvm/src/main/scala/zio/sql/insert.scala | 37 - .../main/scala/zio/sql/insert/Insert.scala | 9 + .../scala/zio/sql/insert/InsertBuilder.scala | 22 + .../zio/sql/insert/InsertByCommaBuilder.scala | 211 ++++ .../src/main/scala/zio/sql/insertutils.scala | 209 ---- .../jvm/src/main/scala/zio/sql/newtypes.scala | 10 - .../zio/sql/{ops.scala => ops/Operator.scala} | 57 +- core/jvm/src/main/scala/zio/sql/package.scala | 12 + core/jvm/src/main/scala/zio/sql/select.scala | 595 ----------- .../zio/sql/select/ColumnSelection.scala | 36 + .../scala/zio/sql/select/DecodingError.scala | 22 + .../main/scala/zio/sql/select/Ordering.scala | 16 + .../src/main/scala/zio/sql/select/Read.scala | 317 ++++++ .../main/scala/zio/sql/select/SelectAll.scala | 27 + .../zio/sql/select/SelectAllHelper.scala | 944 +++++++++++++++++ .../scala/zio/sql/select/SelectBuilder.scala | 59 ++ .../zio/sql/select/SelectByCommaBuilder.scala | 252 +++++ .../main/scala/zio/sql/select/Selection.scala | 47 + .../scala/zio/sql/select/SelectionSet.scala | 99 ++ .../zio/sql/select/SubselectBuilder.scala | 31 + .../src/main/scala/zio/sql/selectutils.scala | 274 ----- core/jvm/src/main/scala/zio/sql/table.scala | 345 ------- .../src/main/scala/zio/sql/table/Column.scala | 44 + .../zio/sql/table/ExprAccesorBuilder.scala | 29 + .../main/scala/zio/sql/table/JoinType.scala | 10 + .../src/main/scala/zio/sql/table/Table.scala | 199 ++++ .../zio/sql/table/TableNameAnnotation.scala | 8 + core/jvm/src/main/scala/zio/sql/typetag.scala | 105 -- .../scala/zio/sql/typetag/Decodable.scala | 12 + .../main/scala/zio/sql/typetag/IsDate.scala | 20 + .../scala/zio/sql/typetag/IsIntegral.scala | 16 + .../scala/zio/sql/typetag/IsNumeric.scala | 19 + .../main/scala/zio/sql/typetag/TypeTag.scala | 114 +++ core/jvm/src/main/scala/zio/sql/update.scala | 23 - .../main/scala/zio/sql/update/Update.scala | 20 + .../scala/zio/sql/update/UpdateBuilder.scala | 11 + .../Pluralize.scala} | 2 +- .../TrailingUnitNormalizer.scala} | 7 +- .../test/scala/zio/sql/PluralizeSpec.scala | 1 + .../test/scala/zio/sql/ProductSchema.scala | 15 +- .../scala/zio/sql/TestBasicSelectSpec.scala | 15 +- .../sql/postgresql/PostgresSqlModule.scala | 8 +- .../sql/sqlserver/SqlServerSqlModule.scala | 4 +- 54 files changed, 3230 insertions(+), 3131 deletions(-) delete mode 100644 core/jvm/src/main/scala/zio/sql/allcolumns.scala delete mode 100644 core/jvm/src/main/scala/zio/sql/delete.scala create mode 100644 core/jvm/src/main/scala/zio/sql/delete/Delete.scala delete mode 100644 core/jvm/src/main/scala/zio/sql/expr.scala create mode 100644 core/jvm/src/main/scala/zio/sql/expr/AggregationDef.scala create mode 100644 core/jvm/src/main/scala/zio/sql/expr/ComparableTypes.scala create mode 100644 core/jvm/src/main/scala/zio/sql/expr/Expr.scala create mode 100644 core/jvm/src/main/scala/zio/sql/expr/FunctionDef.scala create mode 100644 core/jvm/src/main/scala/zio/sql/expr/FunctionName.scala create mode 100644 core/jvm/src/main/scala/zio/sql/expr/Set.scala delete mode 100644 core/jvm/src/main/scala/zio/sql/insert.scala create mode 100644 core/jvm/src/main/scala/zio/sql/insert/Insert.scala create mode 100644 core/jvm/src/main/scala/zio/sql/insert/InsertBuilder.scala create mode 100644 core/jvm/src/main/scala/zio/sql/insert/InsertByCommaBuilder.scala delete mode 100644 core/jvm/src/main/scala/zio/sql/insertutils.scala delete mode 100644 core/jvm/src/main/scala/zio/sql/newtypes.scala rename core/jvm/src/main/scala/zio/sql/{ops.scala => ops/Operator.scala} (79%) create mode 100644 core/jvm/src/main/scala/zio/sql/package.scala delete mode 100644 core/jvm/src/main/scala/zio/sql/select.scala create mode 100644 core/jvm/src/main/scala/zio/sql/select/ColumnSelection.scala create mode 100644 core/jvm/src/main/scala/zio/sql/select/DecodingError.scala create mode 100644 core/jvm/src/main/scala/zio/sql/select/Ordering.scala create mode 100644 core/jvm/src/main/scala/zio/sql/select/Read.scala create mode 100644 core/jvm/src/main/scala/zio/sql/select/SelectAll.scala create mode 100644 core/jvm/src/main/scala/zio/sql/select/SelectAllHelper.scala create mode 100644 core/jvm/src/main/scala/zio/sql/select/SelectBuilder.scala create mode 100644 core/jvm/src/main/scala/zio/sql/select/SelectByCommaBuilder.scala create mode 100644 core/jvm/src/main/scala/zio/sql/select/Selection.scala create mode 100644 core/jvm/src/main/scala/zio/sql/select/SelectionSet.scala create mode 100644 core/jvm/src/main/scala/zio/sql/select/SubselectBuilder.scala delete mode 100644 core/jvm/src/main/scala/zio/sql/selectutils.scala delete mode 100644 core/jvm/src/main/scala/zio/sql/table.scala create mode 100644 core/jvm/src/main/scala/zio/sql/table/Column.scala create mode 100644 core/jvm/src/main/scala/zio/sql/table/ExprAccesorBuilder.scala create mode 100644 core/jvm/src/main/scala/zio/sql/table/JoinType.scala create mode 100644 core/jvm/src/main/scala/zio/sql/table/Table.scala create mode 100644 core/jvm/src/main/scala/zio/sql/table/TableNameAnnotation.scala delete mode 100644 core/jvm/src/main/scala/zio/sql/typetag.scala create mode 100644 core/jvm/src/main/scala/zio/sql/typetag/Decodable.scala create mode 100644 core/jvm/src/main/scala/zio/sql/typetag/IsDate.scala create mode 100644 core/jvm/src/main/scala/zio/sql/typetag/IsIntegral.scala create mode 100644 core/jvm/src/main/scala/zio/sql/typetag/IsNumeric.scala create mode 100644 core/jvm/src/main/scala/zio/sql/typetag/TypeTag.scala delete mode 100644 core/jvm/src/main/scala/zio/sql/update.scala create mode 100644 core/jvm/src/main/scala/zio/sql/update/Update.scala create mode 100644 core/jvm/src/main/scala/zio/sql/update/UpdateBuilder.scala rename core/jvm/src/main/scala/zio/sql/{pluralize.scala => utils/Pluralize.scala} (99%) rename core/jvm/src/main/scala/zio/sql/{utils.scala => utils/TrailingUnitNormalizer.scala} (99%) diff --git a/core/jvm/src/main/scala/zio/sql/Sql.scala b/core/jvm/src/main/scala/zio/sql/Sql.scala index 6dafbd36e..0c98824c3 100644 --- a/core/jvm/src/main/scala/zio/sql/Sql.scala +++ b/core/jvm/src/main/scala/zio/sql/Sql.scala @@ -1,19 +1,13 @@ package zio.sql import zio.schema.Schema +import zio.sql.table._ +import zio.sql.update._ +import zio.sql.select._ +import zio.sql.insert._ +import zio.sql.delete._ -trait Sql - extends SelectModule - with DeleteModule - with UpdateModule - with ExprModule - with TableModule - with AllColumnsModule - with InsertModule - with UtilsModule - with SelectUtilsModule - with InsertUtilsModule { - self => +trait Sql { /* * (SELECT *, "foo", table.a + table.b AS sum... FROM table WHERE cond) UNION (SELECT ... FROM table) @@ -48,13 +42,24 @@ trait Sql def insertInto[Source, AllColumnIdentities]( table: Table.Source.Aux_[Source, AllColumnIdentities] - ): InsertIntoBuilder[Source, AllColumnIdentities] = InsertIntoBuilder(table) + ): InsertByCommaBuilder[Source, AllColumnIdentities] = InsertByCommaBuilder(table) - def renderDelete(delete: self.Delete[_]): String + def renderDelete(delete: Delete[_]): String - def renderRead(read: self.Read[_]): String + def renderRead(read: Read[_]): String - def renderUpdate(update: self.Update[_]): String + def renderUpdate(update: Update[_]): String - def renderInsert[A: Schema](insert: self.Insert[_, A]): String + def renderInsert[A: Schema](insert: Insert[_, A]): String + + //TODO don't know where to put it now + implicit def convertOptionToSome[A](implicit op: Schema[Option[A]]): Schema[Some[A]] = + op.transformOrFail[Some[A]]( + { + case Some(a) => Right(Some(a)) + case None => Left("cannot encode Right") + }, + someA => Right(someA) + ) + implicit val none: Schema[None.type] = Schema.singleton(None) } diff --git a/core/jvm/src/main/scala/zio/sql/allcolumns.scala b/core/jvm/src/main/scala/zio/sql/allcolumns.scala deleted file mode 100644 index ec45d0617..000000000 --- a/core/jvm/src/main/scala/zio/sql/allcolumns.scala +++ /dev/null @@ -1,945 +0,0 @@ -package zio.sql - -import scala.annotation.implicitNotFound - -trait AllColumnsModule { self: SelectModule with ExprModule => - - @implicitNotFound( - "SELECT * currently not supported on joined tables, derived tables and for table of size bigger than 22." - ) - sealed trait ColumnsHelper[ColumnsOut, TableType] { - type F - type SelSet <: SelectionSet[TableType] - type ResultTypeRepr - type ColumnHead - type SelectionTail <: SelectionSet[TableType] - - def apply(columns: ColumnsOut): SelectBuilder[F, TableType, SelSet] - } - - // format: off - object ColumnsHelper { - - type Aux[ColumnsOut0, TableType0, F0, SelectionSet0, ResultTypeRepr0, ColumnsHead0, SelectionTail0] = - ColumnsHelper[ColumnsOut0, TableType0] { - type F = F0 - - type SelSet = SelectionSet0 - - type ResultTypeRepr = ResultTypeRepr0 - type ColumnHead = ColumnsHead0 - type SelectionTail = SelectionTail0 - } - - implicit def instance1[F1, TableType, A1]: ColumnsHelper.Aux[Expr[ - F1, - TableType, - A1 - ], TableType, F1, SelectionSet.Cons[TableType, A1, SelectionSet.Empty], A1, A1, SelectionSet.Empty] = - new ColumnsHelper[Expr[F1, TableType, A1], TableType] { - - override type F = F1 - override type SelSet = SelectionSet.Cons[TableType, A1, SelectionSet.Empty] - - override type ResultTypeRepr = A1 - - override type ColumnHead = A1 - override type SelectionTail = SelectionSet.Empty - - override def apply(columns: Expr[F1, TableType, A1]) = - SelectBuilder[F1, TableType, SelectionSet.Cons[TableType, A1, SelectionSet.Empty]](columns) - } - - implicit def instance2[F1, F2, TableType, A1, A2] - : ColumnsHelper.Aux[(Expr[F1, TableType, A1], Expr[F2, TableType, A2]), TableType, F1 with F2, SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Empty] - ], (A1, A2), A1, SelectionSet.Cons[TableType, A2, SelectionSet.Empty]] = - new ColumnsHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2]), TableType] { - - override type F = F1 with F2 - override type SelSet = SelectionSet.Cons[TableType, A1, SelectionSet.Cons[TableType, A2, SelectionSet.Empty]] - - override type ResultTypeRepr = (A1, A2) - - override type ColumnHead = A1 - override type SelectionTail = SelectionSet.Cons[TableType, A2, SelectionSet.Empty] - - override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2])) = { - val selection = columns._1 ++ columns._2 - - SelectBuilder[ - F1 with F2, - TableType, - SelectionSet.Cons[TableType, A1, SelectionSet.Cons[TableType, A2, SelectionSet.Empty]] - ](selection) - } - } - - implicit def instance3[F1, F2, F3, TableType, A1, A2, A3]: ColumnsHelper.Aux[ - (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3]), - TableType, - F1 with F2 with F3, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Empty]] - ], - (A1, A2, A3), - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Empty]] - ] = - new ColumnsHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3]), TableType] { - - override type F = F1 with F2 with F3 - override type SelSet = SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Empty]] - ] - - override type ResultTypeRepr = (A1, A2, A3) - - override type ColumnHead = A1 - override type SelectionTail = - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Empty]] - - override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3])) = { - val selection = columns._1 ++ columns._2 ++ columns._3 - - SelectBuilder[ - F1 with F2 with F3, - TableType, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Empty]] - ] - ](selection) - } - } - - - implicit def instance4[F1, F2, F3, F4, TableType, A1, A2, A3, A4]: ColumnsHelper.Aux[ - (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4]), - TableType, - F1 with F2 with F3 with F4, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Empty]]] - ], - (A1, A2, A3, A4), - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Empty]]] - ] = - new ColumnsHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4]), TableType] { - - override type F = F1 with F2 with F3 with F4 - override type SelSet = SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Empty]]] - ] - - override type ResultTypeRepr = (A1, A2, A3, A4) - - override type ColumnHead = A1 - override type SelectionTail = - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Empty]]] - - override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4])) = { - val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 - - SelectBuilder[ - F1 with F2 with F3 with F4, - TableType, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Empty]]] - ] - ](selection) - } - } - - implicit def instance5[F1, F2, F3, F4, F5, TableType, A1, A2, A3, A4, A5]: ColumnsHelper.Aux[ - (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5]), - TableType, - F1 with F2 with F3 with F4 with F5, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Empty]]]] - ], - (A1, A2, A3, A4, A5), - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Empty]]]] - ] = - new ColumnsHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5]), TableType] { - - override type F = F1 with F2 with F3 with F4 with F5 - override type SelSet = SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Empty]]]] - ] - - override type ResultTypeRepr = (A1, A2, A3, A4, A5) - - override type ColumnHead = A1 - override type SelectionTail = - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Empty]]]] - - override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5])) = { - val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 - - SelectBuilder[ - F1 with F2 with F3 with F4 with F5, - TableType, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Empty]]]] - ] - ](selection) - } - } - - implicit def instance6[F1, F2, F3, F4, F5, F6, TableType, A1, A2, A3, A4, A5, A6]: ColumnsHelper.Aux[ - (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6]), - TableType, - F1 with F2 with F3 with F4 with F5 with F6, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Empty]]]]] - ], - (A1, A2, A3, A4, A5, A6), - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Empty]]]]] - ] = - new ColumnsHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6]), TableType] { - - override type F = F1 with F2 with F3 with F4 with F5 with F6 - override type SelSet = SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Empty]]]]] - ] - - override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6) - - override type ColumnHead = A1 - override type SelectionTail = - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Empty]]]]] - - override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6])) = { - val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 - - SelectBuilder[ - F1 with F2 with F3 with F4 with F5 with F6, - TableType, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Empty]]]]] - ] - ](selection) - } - } - - implicit def instance7[F1, F2, F3, F4, F5, F6, F7, TableType, A1, A2, A3, A4, A5, A6, A7]: ColumnsHelper.Aux[ - (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7]), - TableType, - F1 with F2 with F3 with F4 with F5 with F6 with F7, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Empty]]]]]] - ], - (A1, A2, A3, A4, A5, A6, A7), - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Empty]]]]]] - ] = - new ColumnsHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7]), TableType] { - - override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 - override type SelSet = SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Empty]]]]]] - ] - - override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7) - - override type ColumnHead = A1 - override type SelectionTail = - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Empty]]]]]] - - override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7])) = { - val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 - - SelectBuilder[ - F1 with F2 with F3 with F4 with F5 with F6 with F7, - TableType, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Empty]]]]]] - ] - ](selection) - } - } - - implicit def instance8[F1, F2, F3, F4, F5, F6, F7, F8, TableType, A1, A2, A3, A4, A5, A6, A7, A8]: ColumnsHelper.Aux[ - (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8]), - TableType, - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Empty]]]]]]] - ], - (A1, A2, A3, A4, A5, A6, A7, A8), - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Empty]]]]]]] - ] = - new ColumnsHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8]), TableType] { - - override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 - override type SelSet = SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Empty]]]]]]] - ] - - override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8) - - override type ColumnHead = A1 - override type SelectionTail = - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Empty]]]]]]] - - override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8])) = { - val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 - - SelectBuilder[ - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8, - TableType, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Empty]]]]]]] - ] - ](selection) - } - } - - implicit def instance9[F1, F2, F3, F4, F5, F6, F7, F8, F9, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9]: ColumnsHelper.Aux[ - (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9]), - TableType, - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Empty]]]]]]]] - ], - (A1, A2, A3, A4, A5, A6, A7, A8, A9), - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Empty]]]]]]]] - ] = - new ColumnsHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9]), TableType] { - - override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 - override type SelSet = SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Empty]]]]]]]] - ] - - override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9) - - override type ColumnHead = A1 - override type SelectionTail = - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Empty]]]]]]]] - - override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9])) = { - val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 - - SelectBuilder[ - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9, - TableType, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Empty]]]]]]]] - ] - ](selection) - } - } - - - implicit def instance10[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10]: ColumnsHelper.Aux[ - (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10]), - TableType, - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Empty]]]]]]]]] - ], - (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10), - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Empty]]]]]]]]] - ] = - new ColumnsHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10]), TableType] { - - override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 - override type SelSet = SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Empty]]]]]]]]] - ] - - override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) - - override type ColumnHead = A1 - override type SelectionTail = - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Empty]]]]]]]]] - - override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10])) = { - val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 - - SelectBuilder[ - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10, - TableType, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Empty]]]]]]]]] - ] - ](selection) - } - } - - implicit def instance11[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11]: ColumnsHelper.Aux[ - (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11]), - TableType, - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Empty]]]]]]]]]] - ], - (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11), - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Empty]]]]]]]]]] - ] = - new ColumnsHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11]), TableType] { - - override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 - override type SelSet = SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Empty]]]]]]]]]] - ] - - override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) - - override type ColumnHead = A1 - override type SelectionTail = - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Empty]]]]]]]]]] - - override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11])) = { - val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 - - SelectBuilder[ - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11, - TableType, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Empty]]]]]]]]]] - ] - ](selection) - } - } - - implicit def instance12[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12]: ColumnsHelper.Aux[ - (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12]), - TableType, - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Empty]]]]]]]]]]] - ], - (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12), - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Empty]]]]]]]]]]] - ] = - new ColumnsHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12]), TableType] { - - override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 - override type SelSet = SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Empty]]]]]]]]]]] - ] - - override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12) - - override type ColumnHead = A1 - override type SelectionTail = - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Empty]]]]]]]]]]] - - override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12])) = { - val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 - - SelectBuilder[ - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12, - TableType, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Empty]]]]]]]]]]] - ] - ](selection) - } - } - - implicit def instance13[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13]: ColumnsHelper.Aux[ - (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13]), - TableType, - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Empty]]]]]]]]]]]] - ], - (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13), - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Empty]]]]]]]]]]]] - ] = - new ColumnsHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13]), TableType] { - - override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 - override type SelSet = SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Empty]]]]]]]]]]]] - ] - - override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13) - - override type ColumnHead = A1 - override type SelectionTail = - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Empty]]]]]]]]]]]] - - override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13])) = { - val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 ++ columns._13 - - SelectBuilder[ - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13, - TableType, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Empty]]]]]]]]]]]] - ] - ](selection) - } - } - - implicit def instance14[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14]: ColumnsHelper.Aux[ - (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14]), - TableType, - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Empty]]]]]]]]]]]]] - ], - (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14), - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Empty]]]]]]]]]]]]] - ] = - new ColumnsHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14]), TableType] { - - override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 - override type SelSet = SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Empty]]]]]]]]]]]]] - ] - - override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14) - - override type ColumnHead = A1 - override type SelectionTail = - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Empty]]]]]]]]]]]]] - - override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14])) = { - val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 ++ columns._13 ++ columns._14 - - SelectBuilder[ - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14, - TableType, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Empty]]]]]]]]]]]]] - ] - ](selection) - } - } - - implicit def instance15[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15]: ColumnsHelper.Aux[ - (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15]), - TableType, - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Empty]]]]]]]]]]]]]] - ], - (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15), - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Empty]]]]]]]]]]]]]] - ] = - new ColumnsHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15]), TableType] { - - override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 - override type SelSet = SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Empty]]]]]]]]]]]]]] - ] - - override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15) - - override type ColumnHead = A1 - override type SelectionTail = - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Empty]]]]]]]]]]]]]] - - override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15])) = { - val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 ++ columns._13 ++ columns._14 ++ columns._15 - - SelectBuilder[ - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15, - TableType, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Empty]]]]]]]]]]]]]] - ] - ](selection) - } - } - - implicit def instance16[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16]: ColumnsHelper.Aux[ - (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16]), - TableType, - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Empty]]]]]]]]]]]]]]] - ], - (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16), - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Empty]]]]]]]]]]]]]]] - ] = - new ColumnsHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16]), TableType] { - - override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 - override type SelSet = SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Empty]]]]]]]]]]]]]]] - ] - - override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16) - - override type ColumnHead = A1 - override type SelectionTail = - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Empty]]]]]]]]]]]]]]] - - override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16])) = { - val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 ++ columns._13 ++ columns._14 ++ columns._15 ++ columns._16 - - SelectBuilder[ - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16, - TableType, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Empty]]]]]]]]]]]]]]] - ] - ](selection) - } - } - - implicit def instance17[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17]: ColumnsHelper.Aux[ - (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17]), - TableType, - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Empty]]]]]]]]]]]]]]]] - ], - (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17), - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Empty]]]]]]]]]]]]]]]] - ] = - new ColumnsHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17]), TableType] { - - override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 - override type SelSet = SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Empty]]]]]]]]]]]]]]]] - ] - - override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17) - - override type ColumnHead = A1 - override type SelectionTail = - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Empty]]]]]]]]]]]]]]]] - - override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17])) = { - val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 ++ columns._13 ++ columns._14 ++ columns._15 ++ columns._16 ++ columns._17 - - SelectBuilder[ - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17, - TableType, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Empty]]]]]]]]]]]]]]]] - ] - ](selection) - } - } - - implicit def instance18[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18]: ColumnsHelper.Aux[ - (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18]), - TableType, - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Empty]]]]]]]]]]]]]]]]] - ], - (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18), - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Empty]]]]]]]]]]]]]]]]] - ] = - new ColumnsHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18]), TableType] { - - override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 - override type SelSet = SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Empty]]]]]]]]]]]]]]]]] - ] - - override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18) - - override type ColumnHead = A1 - override type SelectionTail = - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Empty]]]]]]]]]]]]]]]]] - - override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18])) = { - val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 ++ columns._13 ++ columns._14 ++ columns._15 ++ columns._16 ++ columns._17 ++ columns._18 - - SelectBuilder[ - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18, - TableType, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Empty]]]]]]]]]]]]]]]]] - ] - ](selection) - } - } - - implicit def instance19[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19]: ColumnsHelper.Aux[ - (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19]), - TableType, - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Empty]]]]]]]]]]]]]]]]]] - ], - (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19), - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Empty]]]]]]]]]]]]]]]]]] - ] = - new ColumnsHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19]), TableType] { - - override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 - override type SelSet = SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Empty]]]]]]]]]]]]]]]]]] - ] - - override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19) - - override type ColumnHead = A1 - override type SelectionTail = - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Empty]]]]]]]]]]]]]]]]]] - - override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19])) = { - val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 ++ columns._13 ++ columns._14 ++ columns._15 ++ columns._16 ++ columns._17 ++ columns._18 ++ columns._19 - - SelectBuilder[ - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19, - TableType, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Empty]]]]]]]]]]]]]]]]]] - ] - ](selection) - } - } - - implicit def instance20[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20]: ColumnsHelper.Aux[ - (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19], Expr[F20, TableType, A20]), - TableType, - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Empty]]]]]]]]]]]]]]]]]]] - ], - (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20), - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Empty]]]]]]]]]]]]]]]]]]] - ] = - new ColumnsHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19], Expr[F20, TableType, A20]), TableType] { - - override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 - override type SelSet = SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Empty]]]]]]]]]]]]]]]]]]] - ] - - override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20) - - override type ColumnHead = A1 - override type SelectionTail = - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Empty]]]]]]]]]]]]]]]]]]] - - override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19], Expr[F20, TableType, A20])) = { - val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 ++ columns._13 ++ columns._14 ++ columns._15 ++ columns._16 ++ columns._17 ++ columns._18 ++ columns._19 ++ columns._20 - - SelectBuilder[ - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20, - TableType, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Empty]]]]]]]]]]]]]]]]]]] - ] - ](selection) - } - } - - implicit def instance21[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21]: ColumnsHelper.Aux[ - (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19], Expr[F20, TableType, A20], Expr[F21, TableType, A21]), - TableType, - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Cons[TableType, A21, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]] - ], - (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21), - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Cons[TableType, A21, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]] - ] = - new ColumnsHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19], Expr[F20, TableType, A20], Expr[F21, TableType, A21]), TableType] { - - override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21 - override type SelSet = SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Cons[TableType, A21, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]] - ] - - override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21) - - override type ColumnHead = A1 - override type SelectionTail = - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Cons[TableType, A21, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]] - - override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19], Expr[F20, TableType, A20], Expr[F21, TableType, A21])) = { - val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 ++ columns._13 ++ columns._14 ++ columns._15 ++ columns._16 ++ columns._17 ++ columns._18 ++ columns._19 ++ columns._20 ++ columns._21 - - SelectBuilder[ - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21, - TableType, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Cons[TableType, A21, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]] - ] - ](selection) - } - } - - implicit def instance22[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22]: ColumnsHelper.Aux[ - (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19], Expr[F20, TableType, A20], Expr[F21, TableType, A21], Expr[F22, TableType, A22]), - TableType, - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21 with F22, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Cons[TableType, A21, SelectionSet.Cons[TableType, A22, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]] - ], - (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22), - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Cons[TableType, A21, SelectionSet.Cons[TableType, A22, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]] - ] = - new ColumnsHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19], Expr[F20, TableType, A20], Expr[F21, TableType, A21], Expr[F22, TableType, A22]), TableType] { - - override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21 with F22 - override type SelSet = SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Cons[TableType, A21, SelectionSet.Cons[TableType, A22, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]] - ] - - override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22) - - override type ColumnHead = A1 - override type SelectionTail = - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Cons[TableType, A21, SelectionSet.Cons[TableType, A22, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]] - - override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19], Expr[F20, TableType, A20], Expr[F21, TableType, A21], Expr[F22, TableType, A22])) = { - val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 ++ columns._13 ++ columns._14 ++ columns._15 ++ columns._16 ++ columns._17 ++ columns._18 ++ columns._19 ++ columns._20 ++ columns._21 ++ columns._22 - - SelectBuilder[ - F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21 with F22, - TableType, - SelectionSet.Cons[ - TableType, - A1, - SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Cons[TableType, A21, SelectionSet.Cons[TableType, A22, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]] - ] - ](selection) - } - } - - } - // format: on - -} diff --git a/core/jvm/src/main/scala/zio/sql/delete.scala b/core/jvm/src/main/scala/zio/sql/delete.scala deleted file mode 100644 index ee53ab2f9..000000000 --- a/core/jvm/src/main/scala/zio/sql/delete.scala +++ /dev/null @@ -1,8 +0,0 @@ -package zio.sql - -trait DeleteModule { self: ExprModule with TableModule with SelectModule => - - sealed case class Delete[A](table: Table.Aux[A], whereExpr: Expr[_, A, Boolean]) { - def where[F](expr: Expr[F, A, Boolean]): Delete[A] = Delete(table, expr) - } -} diff --git a/core/jvm/src/main/scala/zio/sql/delete/Delete.scala b/core/jvm/src/main/scala/zio/sql/delete/Delete.scala new file mode 100644 index 000000000..205ea1386 --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/delete/Delete.scala @@ -0,0 +1,8 @@ +package zio.sql.delete + +import zio.sql.table._ +import zio.sql.expr.Expr + +final case class Delete[A](table: Table.Aux[A], whereExpr: Expr[_, A, Boolean]) { + def where[F](expr: Expr[F, A, Boolean]): Delete[A] = Delete(table, expr) +} diff --git a/core/jvm/src/main/scala/zio/sql/expr.scala b/core/jvm/src/main/scala/zio/sql/expr.scala deleted file mode 100644 index 0131f2fa7..000000000 --- a/core/jvm/src/main/scala/zio/sql/expr.scala +++ /dev/null @@ -1,515 +0,0 @@ -package zio.sql - -import com.github.ghik.silencer.silent - -import java.time._ -import scala.language.implicitConversions -import java.math.BigDecimal -import scala.annotation.implicitNotFound - -trait ExprModule extends NewtypesModule with OpsModule { - self: SelectModule with TableModule => - - /** - * Models a function `A => B`. - * SELECT product.price + 10 - */ - sealed trait Expr[-F, -A, +B] { self => - - def +[F2, A1 <: A, B1 >: B](that: Expr[F2, A1, B1])(implicit ev: IsNumeric[B1]): Expr[F with F2, A1, B1] = - Expr.Binary(self, that, BinaryOp.Add[B1]()) - - def -[F2, A1 <: A, B1 >: B](that: Expr[F2, A1, B1])(implicit ev: IsNumeric[B1]): Expr[F with F2, A1, B1] = - Expr.Binary(self, that, BinaryOp.Sub[B1]()) - - def *[F2, A1 <: A, B1 >: B](that: Expr[F2, A1, B1])(implicit ev: IsNumeric[B1]): Expr[F with F2, A1, B1] = - Expr.Binary(self, that, BinaryOp.Mul[B1]()) - - // todo do something special for divide by 0? also Mod/log/whatever else is really a partial function.. PartialExpr? - def /[F2, A1 <: A, B1 >: B](that: Expr[F2, A1, B1])(implicit ev: IsNumeric[B1]): Expr[F with F2, A1, B1] = - Expr.Binary(self, that, BinaryOp.Div[B1]()) - - def &&[F2, A1 <: A, B1 >: B]( - that: Expr[F2, A1, Boolean] - )(implicit ev: B <:< Boolean): Expr[F with F2, A1, Boolean] = - Expr.Binary(self.widen[Boolean], that, BinaryOp.AndBool) - - def ||[F2, A1 <: A, B1 >: B]( - that: Expr[F2, A1, Boolean] - )(implicit ev: B <:< Boolean): Expr[F with F2, A1, Boolean] = - Expr.Binary(self.widen[Boolean], that, BinaryOp.OrBool) - - def ===[F2, A1 <: A, B1 >: B, B2](that: Expr[F2, A1, B2])(implicit - ct: ComparableTypes[B1, B2] - ): Expr[F with F2, A1, Boolean] = - Expr.Relational(self, that, RelationalOp.Equals) - - def <>[F2, A1 <: A, B1 >: B, B2](that: Expr[F2, A1, B2])(implicit - ct: ComparableTypes[B1, B2] - ): Expr[F with F2, A1, Boolean] = - Expr.Relational(self, that, RelationalOp.NotEqual) - - def >[F2, A1 <: A, B1 >: B, B2](that: Expr[F2, A1, B2])(implicit - ct: ComparableTypes[B1, B2] - ): Expr[F with F2, A1, Boolean] = - Expr.Relational(self, that, RelationalOp.GreaterThan) - - def <[F2, A1 <: A, B1 >: B, B2](that: Expr[F2, A1, B2])(implicit - ct: ComparableTypes[B1, B2] - ): Expr[F with F2, A1, Boolean] = - Expr.Relational(self, that, RelationalOp.LessThan) - - def >=[F2, A1 <: A, B1 >: B, B2](that: Expr[F2, A1, B2])(implicit - ct: ComparableTypes[B1, B2] - ): Expr[F with F2, A1, Boolean] = - Expr.Relational(self, that, RelationalOp.GreaterThanEqual) - - def <=[F2, A1 <: A, B1 >: B, B2](that: Expr[F2, A1, B2])(implicit - ct: ComparableTypes[B1, B2] - ): Expr[F with F2, A1, Boolean] = - Expr.Relational(self, that, RelationalOp.LessThanEqual) - - def like[F2, A1 <: A](that: Expr[F2, A1, String])(implicit ev: B <:< String): Expr[F with F2, A1, Boolean] = - Expr.Relational(self, that, RelationalOp.Like) - - def &[F2, A1 <: A, B1 >: B](that: Expr[F2, A1, B1])(implicit ev: IsIntegral[B1]): Expr[F with F2, A1, B1] = - Expr.Binary(self, that, BinaryOp.AndBit[B1]()) - - def |[F2, A1 <: A, B1 >: B](that: Expr[F2, A1, B1])(implicit ev: IsIntegral[B1]): Expr[F with F2, A1, B1] = - Expr.Binary(self, that, BinaryOp.OrBit[B1]()) - - def unary_~[F1 <: F, B1 >: B](implicit ev: IsIntegral[B1]): Expr.Unary[F1, A, B1] = - Expr.Unary(self, UnaryOp.NotBit[B1]()) - - def unary_-[F1 <: F, B1 >: B](implicit ev: IsNumeric[B1]): Expr.Unary[F1, A, B1] = - Expr.Unary(self, UnaryOp.Negate[B1]()) - - def not[F1 <: F, A1 <: A](implicit ev: B <:< Boolean): Expr.Unary[F1, A1, Boolean] = - Expr.Unary[F1, A1, Boolean](self.widen[Boolean], UnaryOp.NotBool) - - def isNull[A1 <: A]: Expr[F, A1, Boolean] = - Expr.Property(self, PropertyOp.IsNull) - - def isNotNull[A1 <: A]: Expr[F, A1, Boolean] = - Expr.Property(self, PropertyOp.IsNotNull) - - def isTrue[A1 <: A](implicit ev: B <:< Boolean): Expr[F, A1, Boolean] = - Expr.Property(self, PropertyOp.IsTrue) - - def isNotTrue[A1 <: A](implicit ev: B <:< Boolean): Expr[F, A1, Boolean] = - Expr.Property(self, PropertyOp.IsNotTrue) - - def as[B1 >: B](name: String): Expr[F, A, B1] = { - val _ = name - self - } - - def ascending: Ordering[Expr[F, A, B]] = Ordering.Asc(self) - - def asc: Ordering[Expr[F, A, B]] = Ordering.Asc(self) - - def descending: Ordering[Expr[F, A, B]] = Ordering.Desc(self) - - def desc: Ordering[Expr[F, A, B]] = Ordering.Desc(self) - - def in[F1 <: F, B1 >: B, B2]( - set: Read[B2] - )(implicit ct: ComparableTypes[B1, B2], ev: Features.IsSource[F1]): Expr[F, A, Boolean] = - Expr.In(self, set) - - def widen[C](implicit ev: B <:< C): Expr[F, A, C] = { - val _ = ev - self.asInstanceOf[Expr[F, A, C]] - } - } - - object Expr { - - implicit val subqueryToExpr = self.Read.Subselect.subselectToExpr _ - - sealed trait InvariantExpr[F, -A, B] extends Expr[F, A, B] { - def typeTag: TypeTag[B] - } - - def typeTagOf[A](expr: Expr[_, _, A]): TypeTag[A] = expr.asInstanceOf[InvariantExpr[_, _, A]].typeTag - - implicit def literal[A: TypeTag](a: A): Expr[Features.Literal, Any, A] = Expr.Literal(a) - - implicit def some[A: TypeTag.NotNull](someA: Some[A]): Expr[Features.Literal, Any, Option[A]] = { - implicit val typeTagA = TypeTag.Nullable[A]() - Expr.Literal[Option[A]](someA) - } - - def exprName[F, A, B](expr: Expr[F, A, B]): Option[String] = - expr match { - case Expr.Source(_, Column.Named(name)) => Some(name) - case _ => None - } - - implicit def expToSelection[F, A, B]( - expr: Expr[F, A, B] - ): Selection[F, A, SelectionSet.Cons[A, B, SelectionSet.Empty]] = - Selection.computedOption[F, A, B](expr, Expr.exprName(expr)) - - // aggregated F should not be propagated - sealed case class Subselect[F <: Features.Aggregated[_], Repr, Source, Subsource, Head]( - subselect: Read.Subselect[F, Repr, _ <: Source, Subsource, Head, SelectionSet.Empty] - ) extends InvariantExpr[Features.Derived, Any, Head] { - override def typeTag: TypeTag[Head] = subselect.selection.value.head.toColumn.typeTag - } - - sealed case class Source[-A, B, ColumnIdentity, TableType] private[sql] ( - tableName: TableName, - column: Column.Aux[B, ColumnIdentity] - ) extends InvariantExpr[Features.Source[ColumnIdentity, TableType], A, B] { - def typeTag: TypeTag[B] = column.typeTag - } - - sealed case class Unary[-F, -A, B](base: Expr[F, A, B], op: UnaryOp[B]) extends Expr[F, A, B] { - def typeTag: TypeTag[B] = typeTagOf(base) - } - - sealed case class Property[F, -A, +B](base: Expr[F, A, B], op: PropertyOp) extends InvariantExpr[F, A, Boolean] { - def typeTag: TypeTag[Boolean] = TypeTag.TBoolean - } - - sealed case class Binary[F1, F2, A, B](left: Expr[F1, A, B], right: Expr[F2, A, B], op: BinaryOp[B]) - extends InvariantExpr[F1 with F2, A, B] { - def typeTag: TypeTag[B] = typeTagOf(left) - } - - sealed case class Relational[F1, F2, A, B](left: Expr[F1, A, B], right: Expr[F2, A, B], op: RelationalOp) - extends InvariantExpr[F1 with F2, A, Boolean] { - def typeTag: TypeTag[Boolean] = TypeTag.TBoolean - } - - sealed case class In[F, A, B](value: Expr[F, A, B], set: Read[B]) extends InvariantExpr[F, A, Boolean] { - def typeTag: TypeTag[Boolean] = TypeTag.TBoolean - } - - sealed case class Literal[B: TypeTag](value: B) extends InvariantExpr[Features.Literal, Any, B] { - def typeTag: TypeTag[B] = implicitly[TypeTag[B]] - } - - sealed case class AggregationCall[F, A, B, Z: TypeTag](param: Expr[F, A, B], aggregation: AggregationDef[B, Z]) - extends InvariantExpr[Features.Aggregated[F], A, Z] { - def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]] - } - - sealed case class ParenlessFunctionCall0[Z: TypeTag](function: FunctionName) - extends InvariantExpr[Features.Function0, Any, Z] { - def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]] - } - - sealed case class FunctionCall0[Z: TypeTag](function: FunctionDef[Any, Z]) - extends InvariantExpr[Features.Function0, Any, Z] { - def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]] - } - - sealed case class FunctionCall1[F, A, B, Z: TypeTag](param: Expr[F, A, B], function: FunctionDef[B, Z]) - extends InvariantExpr[F, A, Z] { - def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]] - } - - sealed case class FunctionCall2[F1, F2, A, B, C, Z: TypeTag]( - param1: Expr[F1, A, B], - param2: Expr[F2, A, C], - function: FunctionDef[(B, C), Z] - ) extends InvariantExpr[F1 with F2, A, Z] { - def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]] - } - - sealed case class FunctionCall3[F1, F2, F3, A, B, C, D, Z: TypeTag]( - param1: Expr[F1, A, B], - param2: Expr[F2, A, C], - param3: Expr[F3, A, D], - function: FunctionDef[(B, C, D), Z] - ) extends InvariantExpr[F1 with F2 with F3, A, Z] { - def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]] - } - - sealed case class FunctionCall4[F1, F2, F3, F4, A, B, C, D, E, Z: TypeTag]( - param1: Expr[F1, A, B], - param2: Expr[F2, A, C], - param3: Expr[F3, A, D], - param4: Expr[F4, A, E], - function: FunctionDef[(B, C, D, E), Z] - ) extends InvariantExpr[F1 with F2 with F3 with F4, A, Z] { - def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]] - } - - sealed case class FunctionCall5[F1, F2, F3, F4, F5, A, B, C, D, E, F, Z: TypeTag]( - param1: Expr[F1, A, B], - param2: Expr[F2, A, C], - param3: Expr[F3, A, D], - param4: Expr[F4, A, E], - param5: Expr[F5, A, F], - function: FunctionDef[(B, C, D, E, F), Z] - ) extends InvariantExpr[F1 with F2 with F3 with F4 with F5, A, Z] { - def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]] - } - - sealed case class FunctionCall6[F1, F2, F3, F4, F5, F6, A, B, C, D, E, F, G, Z: TypeTag]( - param1: Expr[F1, A, B], - param2: Expr[F2, A, C], - param3: Expr[F3, A, D], - param4: Expr[F4, A, E], - param5: Expr[F5, A, F], - param6: Expr[F6, A, G], - function: FunctionDef[(B, C, D, E, F, G), Z] - ) extends InvariantExpr[ - F1 with F2 with F3 with F4 with F5 with F6, - A, - Z - ] { - def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]] - } - - sealed case class FunctionCall7[F1, F2, F3, F4, F5, F6, F7, A, B, C, D, E, F, G, H, Z: TypeTag]( - param1: Expr[F1, A, B], - param2: Expr[F2, A, C], - param3: Expr[F3, A, D], - param4: Expr[F4, A, E], - param5: Expr[F5, A, F], - param6: Expr[F6, A, G], - param7: Expr[F7, A, H], - function: FunctionDef[(B, C, D, E, F, G, H), Z] - ) extends InvariantExpr[ - F1 with F2 with F3 with F4 with F5 with F6 with F7, - A, - Z - ] { - def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]] - } - } - - sealed case class AggregationDef[-A, +B](name: FunctionName) { self => - - def apply[F, Source, B1 >: B](expr: Expr[F, Source, A])(implicit - typeTag: TypeTag[B1] - ): Expr[Features.Aggregated[F], Source, B1] = - Expr.AggregationCall[F, Source, A, B1](expr, self) - } - - object AggregationDef { - val Count = AggregationDef[Any, Long](FunctionName("count")) - val Sum = AggregationDef[Double, Double](FunctionName("sum")) - val SumInt = AggregationDef[Int, Int](FunctionName("sum")) - val SumDec = AggregationDef[BigDecimal, BigDecimal](FunctionName("sum")) - val Avg = AggregationDef[Double, Double](FunctionName("avg")) - val AvgDec = AggregationDef[BigDecimal, BigDecimal](FunctionName("avg")) - def Min[F, A, B: TypeTag](expr: Expr[F, A, B]) = AggregationDef[B, B](FunctionName("min"))(expr) - def Max[F, A, B: TypeTag](expr: Expr[F, A, B]) = AggregationDef[B, B](FunctionName("max"))(expr) - } - - sealed case class FunctionDef[-A, +B](name: FunctionName) { self => - - def apply[B1 >: B]()(implicit ev: Any <:< A, typeTag: TypeTag[B1]): Expr[Features.Function0, Any, B1] = - Expr.FunctionCall0(self.asInstanceOf[FunctionDef[Any, B1]]) - - def apply[F, Source, B1 >: B](param1: Expr[F, Source, A])(implicit typeTag: TypeTag[B1]): Expr[F, Source, B1] = - Expr.FunctionCall1(param1, self: FunctionDef[A, B1]) - - def apply[F1, F2, Source, P1, P2, B1 >: B](param1: Expr[F1, Source, P1], param2: Expr[F2, Source, P2])(implicit - ev: (P1, P2) <:< A, - typeTag: TypeTag[B1] - ): Expr[F1 with F2, Source, B1] = - Expr.FunctionCall2(param1, param2, self.narrow[(P1, P2)]: FunctionDef[(P1, P2), B1]) - - def apply[F1, F2, F3, Source, P1, P2, P3, B1 >: B]( - param1: Expr[F1, Source, P1], - param2: Expr[F2, Source, P2], - param3: Expr[F3, Source, P3] - )(implicit ev: (P1, P2, P3) <:< A, typeTag: TypeTag[B1]): Expr[F1 with F2 with F3, Source, B1] = - Expr.FunctionCall3(param1, param2, param3, self.narrow[(P1, P2, P3)]: FunctionDef[(P1, P2, P3), B1]) - - def apply[F1, F2, F3, F4, Source, P1, P2, P3, P4, B1 >: B]( - param1: Expr[F1, Source, P1], - param2: Expr[F2, Source, P2], - param3: Expr[F3, Source, P3], - param4: Expr[F4, Source, P4] - )(implicit ev: (P1, P2, P3, P4) <:< A, typeTag: TypeTag[B1]): Expr[F1 with F2 with F3 with F4, Source, B1] = - Expr.FunctionCall4( - param1, - param2, - param3, - param4, - self.narrow[(P1, P2, P3, P4)]: FunctionDef[(P1, P2, P3, P4), B1] - ) - - def apply[F1, F2, F3, F4, F5, Source, P1, P2, P3, P4, P5, B1 >: B]( - param1: Expr[F1, Source, P1], - param2: Expr[F2, Source, P2], - param3: Expr[F3, Source, P3], - param4: Expr[F4, Source, P4], - param5: Expr[F5, Source, P5] - )(implicit - ev: (P1, P2, P3, P4, P5) <:< A, - typeTag: TypeTag[B1] - ): Expr[F1 with F2 with F3 with F4 with F5, Source, B1] = - Expr.FunctionCall5( - param1, - param2, - param3, - param4, - param5, - self.narrow[(P1, P2, P3, P4, P5)]: FunctionDef[(P1, P2, P3, P4, P5), B1] - ) - - def apply[F1, F2, F3, F4, F5, F6, Source, P1, P2, P3, P4, P5, P6, B1 >: B]( - param1: Expr[F1, Source, P1], - param2: Expr[F2, Source, P2], - param3: Expr[F3, Source, P3], - param4: Expr[F4, Source, P4], - param5: Expr[F5, Source, P5], - param6: Expr[F6, Source, P6] - )(implicit - ev: (P1, P2, P3, P4, P5, P6) <:< A, - typeTag: TypeTag[B1] - ): Expr[F1 with F2 with F3 with F4 with F5 with F6, Source, B1] = - Expr.FunctionCall6( - param1, - param2, - param3, - param4, - param5, - param6, - self.narrow[(P1, P2, P3, P4, P5, P6)]: FunctionDef[(P1, P2, P3, P4, P5, P6), B1] - ) - - def apply[F1, F2, F3, F4, F5, F6, F7, Source, P1, P2, P3, P4, P5, P6, P7, B1 >: B]( - param1: Expr[F1, Source, P1], - param2: Expr[F2, Source, P2], - param3: Expr[F3, Source, P3], - param4: Expr[F4, Source, P4], - param5: Expr[F5, Source, P5], - param6: Expr[F6, Source, P6], - param7: Expr[F7, Source, P7] - )(implicit - ev: (P1, P2, P3, P4, P5, P6, P7) <:< A, - typeTag: TypeTag[B1] - ): Expr[F1 with F2 with F3 with F4 with F5 with F6 with F7, Source, B1] = - Expr.FunctionCall7( - param1, - param2, - param3, - param4, - param5, - param6, - param7, - self.narrow[(P1, P2, P3, P4, P5, P6, P7)]: FunctionDef[(P1, P2, P3, P4, P5, P6, P7), B1] - ) - - def narrow[C](implicit ev: C <:< A): FunctionDef[C, B] = { - val _ = ev - self.asInstanceOf[FunctionDef[C, B]] - } - } - - object FunctionDef { - - // math functions - val Abs = FunctionDef[Double, Double](FunctionName("abs")) - val Acos = FunctionDef[Double, Double](FunctionName("acos")) - val Asin = FunctionDef[Double, Double](FunctionName("asin")) - val Atan = FunctionDef[Double, Double](FunctionName("atan")) - val Ceil = FunctionDef[Double, Double](FunctionName("ceil")) - val Cos = FunctionDef[Double, Double](FunctionName("cos")) - val Exp = FunctionDef[Double, Double](FunctionName("exp")) - val Floor = FunctionDef[Double, Double](FunctionName("floor")) - val Ln = FunctionDef[Double, Double](FunctionName("ln")) - val Log = FunctionDef[(Double, Double), Double](FunctionName("log")) - val Mod = FunctionDef[(Double, Double), Double](FunctionName("mod")) - val Power = FunctionDef[(Double, Double), Double](FunctionName("power")) - val Round = FunctionDef[(Double, Int), Double](FunctionName("round")) - val Sign = FunctionDef[Double, Int](FunctionName("sign")) - val Sin = FunctionDef[Double, Double](FunctionName("sin")) - val Sqrt = FunctionDef[Double, Double](FunctionName("sqrt")) - val Tan = FunctionDef[Double, Double](FunctionName("tan")) - val WidthBucket = FunctionDef[(Double, Double, Double, Int), Int](FunctionName("width_bucket")) - - // string functions - val Ascii = FunctionDef[String, Int](FunctionName("ascii")) - val CharLength = FunctionDef[String, Int](FunctionName("character_length")) - val Concat = FunctionDef[(String, String), String](FunctionName("concat")) // todo varargs - val ConcatWs3 = FunctionDef[(String, String, String), String](FunctionName("concat_ws")) - val ConcatWs4 = FunctionDef[(String, String, String, String), String](FunctionName("concat_ws")) - val Lower = FunctionDef[String, String](FunctionName("lower")) - val Ltrim = FunctionDef[String, String](FunctionName("ltrim")) - val OctetLength = FunctionDef[String, Int](FunctionName("octet_length")) - val Overlay = FunctionDef[(String, String, Int, Option[Int]), String](FunctionName("overlay")) - val Position = FunctionDef[(String, String), Int](FunctionName("position")) - val Replace = FunctionDef[(String, String, String), String](FunctionName("replace")) - val Rtrim = FunctionDef[String, String](FunctionName("rtrim")) - val Substring = FunctionDef[(String, Int, Option[Int]), String](FunctionName("substring")) - // TODO substring regex - val Trim = FunctionDef[String, String](FunctionName("trim")) - val Upper = FunctionDef[String, String](FunctionName("upper")) - - // date functions - val CurrentTimestamp = FunctionDef[Nothing, Instant](FunctionName("current_timestamp")) - } - - sealed trait Set[F, -A] { - type Value - - def lhs: Expr[F, A, Value] - def rhs: Expr[_, A, Value] - - def typeTag: TypeTag[Value] - - } - - object Set { - type Aux[F, -A, Value0] = Set[F, A] { type Value = Value0 } - - @silent - def apply[F: Features.IsSource, A, Value0: TypeTag]( - lhs0: Expr[F, A, Value0], - rhs0: Expr[_, A, Value0] - ): Set.Aux[F, A, Value0] = - new Set[F, A] { - type Value = Value0 - - def lhs = lhs0 - def rhs = rhs0 - - def typeTag = implicitly[TypeTag[Value]] - } - } - - @implicitNotFound( - "You cannot compare values of different types ${A} and ${B}. " + - "As those are unrelated types, this query would fail at database level." - ) - sealed trait ComparableTypes[A, B] - - object ComparableTypes extends ComparableTypesLowPriority { - implicit final def comparableSubtype1[A <: B, B]: ComparableTypes[A, B] = new ComparableTypes[A, B] {} - - implicit final def AWithOptionIsComparable[A]: ComparableTypes[A, Option[A]] = new ComparableTypes[A, Option[A]] {} - implicit final def optionWithAIsComparable[A]: ComparableTypes[Option[A], A] = new ComparableTypes[Option[A], A] {} - - implicit final def optionAndNone[A]: ComparableTypes[Option[A], None.type] = - new ComparableTypes[Option[A], None.type] {} - implicit final def noneAndOption[A]: ComparableTypes[None.type, Option[A]] = - new ComparableTypes[None.type, Option[A]] {} - - implicit final def optionAndSome[A]: ComparableTypes[Option[A], Expr.Literal[Some[A]]] = - new ComparableTypes[Option[A], Expr.Literal[Some[A]]] {} - implicit final def someAndOption[A]: ComparableTypes[Expr.Literal[Some[A]], Option[A]] = - new ComparableTypes[Expr.Literal[Some[A]], Option[A]] {} - - implicit final def dateIsComprable[A, B](implicit ev1: IsDate[A], ev2: IsDate[B]): ComparableTypes[A, B] = - new ComparableTypes[A, B] {} - - implicit final def numericIsComparable[A, B](implicit - ev1: IsNumeric[A], - ev2: IsNumeric[B] - ): ComparableTypes[A, B] = new ComparableTypes[A, B] {} - } - - sealed trait ComparableTypesLowPriority { - implicit final def comparableSubtype2[A, B <: A]: ComparableTypes[A, B] = new ComparableTypes[A, B] {} - } -} diff --git a/core/jvm/src/main/scala/zio/sql/expr/AggregationDef.scala b/core/jvm/src/main/scala/zio/sql/expr/AggregationDef.scala new file mode 100644 index 000000000..7f9f31304 --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/expr/AggregationDef.scala @@ -0,0 +1,23 @@ +package zio.sql.expr + +import zio.sql.typetag.TypeTag +import zio.sql.Features + +final case class AggregationDef[-A, +B](name: FunctionName) { self => + + def apply[F, Source, B1 >: B](expr: Expr[F, Source, A])(implicit + typeTag: TypeTag[B1] + ): Expr[Features.Aggregated[F], Source, B1] = + Expr.AggregationCall[F, Source, A, B1](expr, self) +} + +object AggregationDef { + val Count = AggregationDef[Any, Long](FunctionName("count")) + val Sum = AggregationDef[Double, Double](FunctionName("sum")) + val SumInt = AggregationDef[Int, Int](FunctionName("sum")) + val SumDec = AggregationDef[BigDecimal, BigDecimal](FunctionName("sum")) + val Avg = AggregationDef[Double, Double](FunctionName("avg")) + val AvgDec = AggregationDef[BigDecimal, BigDecimal](FunctionName("avg")) + def Min[F, A, B: TypeTag](expr: Expr[F, A, B]) = AggregationDef[B, B](FunctionName("min"))(expr) + def Max[F, A, B: TypeTag](expr: Expr[F, A, B]) = AggregationDef[B, B](FunctionName("max"))(expr) +} diff --git a/core/jvm/src/main/scala/zio/sql/expr/ComparableTypes.scala b/core/jvm/src/main/scala/zio/sql/expr/ComparableTypes.scala new file mode 100644 index 000000000..2812ac452 --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/expr/ComparableTypes.scala @@ -0,0 +1,39 @@ +package zio.sql.expr + +import scala.annotation.implicitNotFound +import zio.sql.typetag._ + +@implicitNotFound( + "You cannot compare values of different types ${A} and ${B}. " + + "As those are unrelated types, this query would fail at database level." +) +sealed trait ComparableTypes[A, B] + +object ComparableTypes extends ComparableTypesLowPriority { + implicit final def comparableSubtype1[A <: B, B]: ComparableTypes[A, B] = new ComparableTypes[A, B] {} + + implicit final def AWithOptionIsComparable[A]: ComparableTypes[A, Option[A]] = new ComparableTypes[A, Option[A]] {} + implicit final def optionWithAIsComparable[A]: ComparableTypes[Option[A], A] = new ComparableTypes[Option[A], A] {} + + implicit final def optionAndNone[A]: ComparableTypes[Option[A], None.type] = + new ComparableTypes[Option[A], None.type] {} + implicit final def noneAndOption[A]: ComparableTypes[None.type, Option[A]] = + new ComparableTypes[None.type, Option[A]] {} + + implicit final def optionAndSome[A]: ComparableTypes[Option[A], Expr.Literal[Some[A]]] = + new ComparableTypes[Option[A], Expr.Literal[Some[A]]] {} + implicit final def someAndOption[A]: ComparableTypes[Expr.Literal[Some[A]], Option[A]] = + new ComparableTypes[Expr.Literal[Some[A]], Option[A]] {} + + implicit final def dateIsComprable[A, B](implicit ev1: IsDate[A], ev2: IsDate[B]): ComparableTypes[A, B] = + new ComparableTypes[A, B] {} + + implicit final def numericIsComparable[A, B](implicit + ev1: IsNumeric[A], + ev2: IsNumeric[B] + ): ComparableTypes[A, B] = new ComparableTypes[A, B] {} +} + +sealed trait ComparableTypesLowPriority { + implicit final def comparableSubtype2[A, B <: A]: ComparableTypes[A, B] = new ComparableTypes[A, B] {} +} \ No newline at end of file diff --git a/core/jvm/src/main/scala/zio/sql/expr/Expr.scala b/core/jvm/src/main/scala/zio/sql/expr/Expr.scala new file mode 100644 index 000000000..2b49d570b --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/expr/Expr.scala @@ -0,0 +1,282 @@ +package zio.sql.expr + +import scala.language.implicitConversions +import zio.sql.table._ +import zio.sql.typetag._ +import zio.sql.ops.Operator._ +import zio.sql.select._ +import zio.sql.Features +import zio.sql.select.{ Read, Selection, SelectionSet } + +/** + * Models a function `A => B`. + * SELECT product.price + 10 + */ +sealed trait Expr[-F, -A, +B] { self => + + def +[F2, A1 <: A, B1 >: B](that: Expr[F2, A1, B1])(implicit ev: IsNumeric[B1]): Expr[F with F2, A1, B1] = + Expr.Binary(self, that, BinaryOp.Add[B1]()) + + def -[F2, A1 <: A, B1 >: B](that: Expr[F2, A1, B1])(implicit ev: IsNumeric[B1]): Expr[F with F2, A1, B1] = + Expr.Binary(self, that, BinaryOp.Sub[B1]()) + + def *[F2, A1 <: A, B1 >: B](that: Expr[F2, A1, B1])(implicit ev: IsNumeric[B1]): Expr[F with F2, A1, B1] = + Expr.Binary(self, that, BinaryOp.Mul[B1]()) + + // todo do something special for divide by 0? also Mod/log/whatever else is really a partial function.. PartialExpr? + def /[F2, A1 <: A, B1 >: B](that: Expr[F2, A1, B1])(implicit ev: IsNumeric[B1]): Expr[F with F2, A1, B1] = + Expr.Binary(self, that, BinaryOp.Div[B1]()) + + def &&[F2, A1 <: A, B1 >: B]( + that: Expr[F2, A1, Boolean] + )(implicit ev: B <:< Boolean): Expr[F with F2, A1, Boolean] = + Expr.Binary(self.widen[Boolean], that, BinaryOp.AndBool) + + def ||[F2, A1 <: A, B1 >: B]( + that: Expr[F2, A1, Boolean] + )(implicit ev: B <:< Boolean): Expr[F with F2, A1, Boolean] = + Expr.Binary(self.widen[Boolean], that, BinaryOp.OrBool) + + def ===[F2, A1 <: A, B1 >: B, B2](that: Expr[F2, A1, B2])(implicit + ct: ComparableTypes[B1, B2] + ): Expr[F with F2, A1, Boolean] = + Expr.Relational(self, that, RelationalOp.Equals) + + def <>[F2, A1 <: A, B1 >: B, B2](that: Expr[F2, A1, B2])(implicit + ct: ComparableTypes[B1, B2] + ): Expr[F with F2, A1, Boolean] = + Expr.Relational(self, that, RelationalOp.NotEqual) + + def >[F2, A1 <: A, B1 >: B, B2](that: Expr[F2, A1, B2])(implicit + ct: ComparableTypes[B1, B2] + ): Expr[F with F2, A1, Boolean] = + Expr.Relational(self, that, RelationalOp.GreaterThan) + + def <[F2, A1 <: A, B1 >: B, B2](that: Expr[F2, A1, B2])(implicit + ct: ComparableTypes[B1, B2] + ): Expr[F with F2, A1, Boolean] = + Expr.Relational(self, that, RelationalOp.LessThan) + + def >=[F2, A1 <: A, B1 >: B, B2](that: Expr[F2, A1, B2])(implicit + ct: ComparableTypes[B1, B2] + ): Expr[F with F2, A1, Boolean] = + Expr.Relational(self, that, RelationalOp.GreaterThanEqual) + + def <=[F2, A1 <: A, B1 >: B, B2](that: Expr[F2, A1, B2])(implicit + ct: ComparableTypes[B1, B2] + ): Expr[F with F2, A1, Boolean] = + Expr.Relational(self, that, RelationalOp.LessThanEqual) + + def like[F2, A1 <: A](that: Expr[F2, A1, String])(implicit ev: B <:< String): Expr[F with F2, A1, Boolean] = + Expr.Relational(self, that, RelationalOp.Like) + + def &[F2, A1 <: A, B1 >: B](that: Expr[F2, A1, B1])(implicit ev: IsIntegral[B1]): Expr[F with F2, A1, B1] = + Expr.Binary(self, that, BinaryOp.AndBit[B1]()) + + def |[F2, A1 <: A, B1 >: B](that: Expr[F2, A1, B1])(implicit ev: IsIntegral[B1]): Expr[F with F2, A1, B1] = + Expr.Binary(self, that, BinaryOp.OrBit[B1]()) + + def unary_~[F1 <: F, B1 >: B](implicit ev: IsIntegral[B1]): Expr.Unary[F1, A, B1] = + Expr.Unary(self, UnaryOp.NotBit[B1]()) + + def unary_-[F1 <: F, B1 >: B](implicit ev: IsNumeric[B1]): Expr.Unary[F1, A, B1] = + Expr.Unary(self, UnaryOp.Negate[B1]()) + + def not[F1 <: F, A1 <: A](implicit ev: B <:< Boolean): Expr.Unary[F1, A1, Boolean] = + Expr.Unary[F1, A1, Boolean](self.widen[Boolean], UnaryOp.NotBool) + + def isNull[A1 <: A]: Expr[F, A1, Boolean] = + Expr.Property(self, PropertyOp.IsNull) + + def isNotNull[A1 <: A]: Expr[F, A1, Boolean] = + Expr.Property(self, PropertyOp.IsNotNull) + + def isTrue[A1 <: A](implicit ev: B <:< Boolean): Expr[F, A1, Boolean] = + Expr.Property(self, PropertyOp.IsTrue) + + def isNotTrue[A1 <: A](implicit ev: B <:< Boolean): Expr[F, A1, Boolean] = + Expr.Property(self, PropertyOp.IsNotTrue) + + def as[B1 >: B](name: String): Expr[F, A, B1] = { + val _ = name + self + } + + def ascending: Ordering[Expr[F, A, B]] = Ordering.Asc(self) + + def asc: Ordering[Expr[F, A, B]] = Ordering.Asc(self) + + def descending: Ordering[Expr[F, A, B]] = Ordering.Desc(self) + + def desc: Ordering[Expr[F, A, B]] = Ordering.Desc(self) + + def in[F1 <: F, B1 >: B, B2]( + set: Read[B2] + )(implicit ct: ComparableTypes[B1, B2], ev: Features.IsSource[F1]): Expr[F, A, Boolean] = + Expr.In(self, set) + + def widen[C](implicit ev: B <:< C): Expr[F, A, C] = { + val _ = ev + self.asInstanceOf[Expr[F, A, C]] + } +} + +object Expr { + + implicit val subqueryToExpr = Read.Subselect.subselectToExpr _ + + sealed trait InvariantExpr[F, -A, B] extends Expr[F, A, B] { + def typeTag: TypeTag[B] + } + + def typeTagOf[A](expr: Expr[_, _, A]): TypeTag[A] = expr.asInstanceOf[InvariantExpr[_, _, A]].typeTag + + implicit def literal[A: TypeTag](a: A): Expr[Features.Literal, Any, A] = Expr.Literal(a) + + implicit def some[A: TypeTag.NotNull](someA: Some[A]): Expr[Features.Literal, Any, Option[A]] = { + implicit val typeTagA = TypeTag.Nullable[A]() + Expr.Literal[Option[A]](someA) + } + + def exprName[F, A, B](expr: Expr[F, A, B]): Option[String] = + expr match { + case Expr.Source(_, Column.Named(name)) => Some(name) + case _ => None + } + + implicit def expToSelection[F, A, B]( + expr: Expr[F, A, B] + ): Selection[F, A, SelectionSet.Cons[A, B, SelectionSet.Empty]] = + Selection.computedOption[F, A, B](expr, Expr.exprName(expr)) + + // aggregated F should not be propagated + final case class Subselect[F <: Features.Aggregated[_], Repr, Source, Subsource, Head]( + subselect: Read.Subselect[F, Repr, _ <: Source, Subsource, Head, SelectionSet.Empty] + ) extends InvariantExpr[Features.Derived, Any, Head] { + override def typeTag: TypeTag[Head] = subselect.selection.value.head.toColumn.typeTag + } + + final case class Source[-A, B, ColumnIdentity, TableType] private[sql] ( + tableName: String, + column: Column.Aux[B, ColumnIdentity] + ) extends InvariantExpr[Features.Source[ColumnIdentity, TableType], A, B] { + def typeTag: TypeTag[B] = column.typeTag + } + + final case class Unary[-F, -A, B](base: Expr[F, A, B], op: UnaryOp[B]) extends Expr[F, A, B] { + def typeTag: TypeTag[B] = typeTagOf(base) + } + + final case class Property[F, -A, +B](base: Expr[F, A, B], op: PropertyOp) extends InvariantExpr[F, A, Boolean] { + def typeTag: TypeTag[Boolean] = TypeTag.TBoolean + } + + final case class Binary[F1, F2, A, B](left: Expr[F1, A, B], right: Expr[F2, A, B], op: BinaryOp[B]) + extends InvariantExpr[F1 with F2, A, B] { + def typeTag: TypeTag[B] = typeTagOf(left) + } + + final case class Relational[F1, F2, A, B](left: Expr[F1, A, B], right: Expr[F2, A, B], op: RelationalOp) + extends InvariantExpr[F1 with F2, A, Boolean] { + def typeTag: TypeTag[Boolean] = TypeTag.TBoolean + } + + final case class In[F, A, B](value: Expr[F, A, B], set: Read[B]) extends InvariantExpr[F, A, Boolean] { + def typeTag: TypeTag[Boolean] = TypeTag.TBoolean + } + + final case class Literal[B: TypeTag](value: B) extends InvariantExpr[Features.Literal, Any, B] { + def typeTag: TypeTag[B] = implicitly[TypeTag[B]] + } + + final case class AggregationCall[F, A, B, Z: TypeTag](param: Expr[F, A, B], aggregation: AggregationDef[B, Z]) + extends InvariantExpr[Features.Aggregated[F], A, Z] { + def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]] + } + + final case class ParenlessFunctionCall0[Z: TypeTag](function: FunctionName) + extends InvariantExpr[Features.Function0, Any, Z] { + def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]] + } + + final case class FunctionCall0[Z: TypeTag](function: FunctionDef[Any, Z]) + extends InvariantExpr[Features.Function0, Any, Z] { + def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]] + } + + final case class FunctionCall1[F, A, B, Z: TypeTag](param: Expr[F, A, B], function: FunctionDef[B, Z]) + extends InvariantExpr[F, A, Z] { + def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]] + } + + final case class FunctionCall2[F1, F2, A, B, C, Z: TypeTag]( + param1: Expr[F1, A, B], + param2: Expr[F2, A, C], + function: FunctionDef[(B, C), Z] + ) extends InvariantExpr[F1 with F2, A, Z] { + def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]] + } + + final case class FunctionCall3[F1, F2, F3, A, B, C, D, Z: TypeTag]( + param1: Expr[F1, A, B], + param2: Expr[F2, A, C], + param3: Expr[F3, A, D], + function: FunctionDef[(B, C, D), Z] + ) extends InvariantExpr[F1 with F2 with F3, A, Z] { + def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]] + } + + final case class FunctionCall4[F1, F2, F3, F4, A, B, C, D, E, Z: TypeTag]( + param1: Expr[F1, A, B], + param2: Expr[F2, A, C], + param3: Expr[F3, A, D], + param4: Expr[F4, A, E], + function: FunctionDef[(B, C, D, E), Z] + ) extends InvariantExpr[F1 with F2 with F3 with F4, A, Z] { + def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]] + } + + final case class FunctionCall5[F1, F2, F3, F4, F5, A, B, C, D, E, F, Z: TypeTag]( + param1: Expr[F1, A, B], + param2: Expr[F2, A, C], + param3: Expr[F3, A, D], + param4: Expr[F4, A, E], + param5: Expr[F5, A, F], + function: FunctionDef[(B, C, D, E, F), Z] + ) extends InvariantExpr[F1 with F2 with F3 with F4 with F5, A, Z] { + def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]] + } + + final case class FunctionCall6[F1, F2, F3, F4, F5, F6, A, B, C, D, E, F, G, Z: TypeTag]( + param1: Expr[F1, A, B], + param2: Expr[F2, A, C], + param3: Expr[F3, A, D], + param4: Expr[F4, A, E], + param5: Expr[F5, A, F], + param6: Expr[F6, A, G], + function: FunctionDef[(B, C, D, E, F, G), Z] + ) extends InvariantExpr[ + F1 with F2 with F3 with F4 with F5 with F6, + A, + Z + ] { + def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]] + } + + final case class FunctionCall7[F1, F2, F3, F4, F5, F6, F7, A, B, C, D, E, F, G, H, Z: TypeTag]( + param1: Expr[F1, A, B], + param2: Expr[F2, A, C], + param3: Expr[F3, A, D], + param4: Expr[F4, A, E], + param5: Expr[F5, A, F], + param6: Expr[F6, A, G], + param7: Expr[F7, A, H], + function: FunctionDef[(B, C, D, E, F, G, H), Z] + ) extends InvariantExpr[ + F1 with F2 with F3 with F4 with F5 with F6 with F7, + A, + Z + ] { + def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]] + } +} diff --git a/core/jvm/src/main/scala/zio/sql/expr/FunctionDef.scala b/core/jvm/src/main/scala/zio/sql/expr/FunctionDef.scala new file mode 100644 index 000000000..44c197558 --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/expr/FunctionDef.scala @@ -0,0 +1,153 @@ +package zio.sql.expr + +import java.time._ +import zio.sql.typetag.TypeTag +import zio.sql.Features + +final case class FunctionDef[-A, +B](name: FunctionName) { self => + + def apply[B1 >: B]()(implicit ev: Any <:< A, typeTag: TypeTag[B1]): Expr[Features.Function0, Any, B1] = + Expr.FunctionCall0(self.asInstanceOf[FunctionDef[Any, B1]]) + + def apply[F, Source, B1 >: B](param1: Expr[F, Source, A])(implicit typeTag: TypeTag[B1]): Expr[F, Source, B1] = + Expr.FunctionCall1(param1, self: FunctionDef[A, B1]) + + def apply[F1, F2, Source, P1, P2, B1 >: B](param1: Expr[F1, Source, P1], param2: Expr[F2, Source, P2])(implicit + ev: (P1, P2) <:< A, + typeTag: TypeTag[B1] + ): Expr[F1 with F2, Source, B1] = + Expr.FunctionCall2(param1, param2, self.narrow[(P1, P2)]: FunctionDef[(P1, P2), B1]) + + def apply[F1, F2, F3, Source, P1, P2, P3, B1 >: B]( + param1: Expr[F1, Source, P1], + param2: Expr[F2, Source, P2], + param3: Expr[F3, Source, P3] + )(implicit ev: (P1, P2, P3) <:< A, typeTag: TypeTag[B1]): Expr[F1 with F2 with F3, Source, B1] = + Expr.FunctionCall3(param1, param2, param3, self.narrow[(P1, P2, P3)]: FunctionDef[(P1, P2, P3), B1]) + + def apply[F1, F2, F3, F4, Source, P1, P2, P3, P4, B1 >: B]( + param1: Expr[F1, Source, P1], + param2: Expr[F2, Source, P2], + param3: Expr[F3, Source, P3], + param4: Expr[F4, Source, P4] + )(implicit ev: (P1, P2, P3, P4) <:< A, typeTag: TypeTag[B1]): Expr[F1 with F2 with F3 with F4, Source, B1] = + Expr.FunctionCall4( + param1, + param2, + param3, + param4, + self.narrow[(P1, P2, P3, P4)]: FunctionDef[(P1, P2, P3, P4), B1] + ) + + def apply[F1, F2, F3, F4, F5, Source, P1, P2, P3, P4, P5, B1 >: B]( + param1: Expr[F1, Source, P1], + param2: Expr[F2, Source, P2], + param3: Expr[F3, Source, P3], + param4: Expr[F4, Source, P4], + param5: Expr[F5, Source, P5] + )(implicit + ev: (P1, P2, P3, P4, P5) <:< A, + typeTag: TypeTag[B1] + ): Expr[F1 with F2 with F3 with F4 with F5, Source, B1] = + Expr.FunctionCall5( + param1, + param2, + param3, + param4, + param5, + self.narrow[(P1, P2, P3, P4, P5)]: FunctionDef[(P1, P2, P3, P4, P5), B1] + ) + + def apply[F1, F2, F3, F4, F5, F6, Source, P1, P2, P3, P4, P5, P6, B1 >: B]( + param1: Expr[F1, Source, P1], + param2: Expr[F2, Source, P2], + param3: Expr[F3, Source, P3], + param4: Expr[F4, Source, P4], + param5: Expr[F5, Source, P5], + param6: Expr[F6, Source, P6] + )(implicit + ev: (P1, P2, P3, P4, P5, P6) <:< A, + typeTag: TypeTag[B1] + ): Expr[F1 with F2 with F3 with F4 with F5 with F6, Source, B1] = + Expr.FunctionCall6( + param1, + param2, + param3, + param4, + param5, + param6, + self.narrow[(P1, P2, P3, P4, P5, P6)]: FunctionDef[(P1, P2, P3, P4, P5, P6), B1] + ) + + def apply[F1, F2, F3, F4, F5, F6, F7, Source, P1, P2, P3, P4, P5, P6, P7, B1 >: B]( + param1: Expr[F1, Source, P1], + param2: Expr[F2, Source, P2], + param3: Expr[F3, Source, P3], + param4: Expr[F4, Source, P4], + param5: Expr[F5, Source, P5], + param6: Expr[F6, Source, P6], + param7: Expr[F7, Source, P7] + )(implicit + ev: (P1, P2, P3, P4, P5, P6, P7) <:< A, + typeTag: TypeTag[B1] + ): Expr[F1 with F2 with F3 with F4 with F5 with F6 with F7, Source, B1] = + Expr.FunctionCall7( + param1, + param2, + param3, + param4, + param5, + param6, + param7, + self.narrow[(P1, P2, P3, P4, P5, P6, P7)]: FunctionDef[(P1, P2, P3, P4, P5, P6, P7), B1] + ) + + def narrow[C](implicit ev: C <:< A): FunctionDef[C, B] = { + val _ = ev + self.asInstanceOf[FunctionDef[C, B]] + } +} + +object FunctionDef { + + // math functions + val Abs = FunctionDef[Double, Double](FunctionName("abs")) + val Acos = FunctionDef[Double, Double](FunctionName("acos")) + val Asin = FunctionDef[Double, Double](FunctionName("asin")) + val Atan = FunctionDef[Double, Double](FunctionName("atan")) + val Ceil = FunctionDef[Double, Double](FunctionName("ceil")) + val Cos = FunctionDef[Double, Double](FunctionName("cos")) + val Exp = FunctionDef[Double, Double](FunctionName("exp")) + val Floor = FunctionDef[Double, Double](FunctionName("floor")) + val Ln = FunctionDef[Double, Double](FunctionName("ln")) + val Log = FunctionDef[(Double, Double), Double](FunctionName("log")) + val Mod = FunctionDef[(Double, Double), Double](FunctionName("mod")) + val Power = FunctionDef[(Double, Double), Double](FunctionName("power")) + val Round = FunctionDef[(Double, Int), Double](FunctionName("round")) + val Sign = FunctionDef[Double, Int](FunctionName("sign")) + val Sin = FunctionDef[Double, Double](FunctionName("sin")) + val Sqrt = FunctionDef[Double, Double](FunctionName("sqrt")) + val Tan = FunctionDef[Double, Double](FunctionName("tan")) + val WidthBucket = FunctionDef[(Double, Double, Double, Int), Int](FunctionName("width_bucket")) + + // string functions + val Ascii = FunctionDef[String, Int](FunctionName("ascii")) + val CharLength = FunctionDef[String, Int](FunctionName("character_length")) + val Concat = FunctionDef[(String, String), String](FunctionName("concat")) // todo varargs + val ConcatWs3 = FunctionDef[(String, String, String), String](FunctionName("concat_ws")) + val ConcatWs4 = FunctionDef[(String, String, String, String), String](FunctionName("concat_ws")) + val Lower = FunctionDef[String, String](FunctionName("lower")) + val Ltrim = FunctionDef[String, String](FunctionName("ltrim")) + val OctetLength = FunctionDef[String, Int](FunctionName("octet_length")) + val Overlay = FunctionDef[(String, String, Int, Option[Int]), String](FunctionName("overlay")) + val Position = FunctionDef[(String, String), Int](FunctionName("position")) + val Replace = FunctionDef[(String, String, String), String](FunctionName("replace")) + val Rtrim = FunctionDef[String, String](FunctionName("rtrim")) + val Substring = FunctionDef[(String, Int, Option[Int]), String](FunctionName("substring")) + // TODO substring regex + val Trim = FunctionDef[String, String](FunctionName("trim")) + val Upper = FunctionDef[String, String](FunctionName("upper")) + + // date functions + val CurrentTimestamp = FunctionDef[Nothing, Instant](FunctionName("current_timestamp")) +} diff --git a/core/jvm/src/main/scala/zio/sql/expr/FunctionName.scala b/core/jvm/src/main/scala/zio/sql/expr/FunctionName.scala new file mode 100644 index 000000000..d72d40043 --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/expr/FunctionName.scala @@ -0,0 +1,3 @@ +package zio.sql.expr + +final case class FunctionName(name: String) \ No newline at end of file diff --git a/core/jvm/src/main/scala/zio/sql/expr/Set.scala b/core/jvm/src/main/scala/zio/sql/expr/Set.scala new file mode 100644 index 000000000..fb951857f --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/expr/Set.scala @@ -0,0 +1,33 @@ +package zio.sql.expr + +import zio.sql.typetag.TypeTag +import zio.sql.Features +import com.github.ghik.silencer.silent + +sealed trait Set[F, -A] { + type Value + + def lhs: Expr[F, A, Value] + def rhs: Expr[_, A, Value] + + def typeTag: TypeTag[Value] + +} + +object Set { + type Aux[F, -A, Value0] = Set[F, A] { type Value = Value0 } + + @silent + def apply[F: Features.IsSource, A, Value0: TypeTag]( + lhs0: Expr[F, A, Value0], + rhs0: Expr[_, A, Value0] + ): Set.Aux[F, A, Value0] = + new Set[F, A] { + type Value = Value0 + + def lhs = lhs0 + def rhs = rhs0 + + def typeTag = implicitly[TypeTag[Value]] + } +} \ No newline at end of file diff --git a/core/jvm/src/main/scala/zio/sql/insert.scala b/core/jvm/src/main/scala/zio/sql/insert.scala deleted file mode 100644 index 2e0a6523b..000000000 --- a/core/jvm/src/main/scala/zio/sql/insert.scala +++ /dev/null @@ -1,37 +0,0 @@ -package zio.sql - -import zio.schema.Schema -import zio.sql.macros._ - -trait InsertModule { self: ExprModule with TableModule with SelectModule => - - sealed case class InsertBuilder[F, Source, AllColumnIdentities, B <: SelectionSet[Source], ColsRepr]( - table: Table.Source.Aux_[Source, AllColumnIdentities], - sources: Selection.Aux[F, Source, B, ColsRepr] - ) { - - def values[Z](values: Seq[Z])(implicit - schemaCC: Schema[Z], - schemaValidity: InsertLike[F, ColsRepr, AllColumnIdentities, Z] - ): Insert[Source, Z] = Insert(table, sources.value, values) - - def values[Z](value: Z)(implicit - schemaCC: Schema[Z], - schemaValidity: InsertLike[F, ColsRepr, AllColumnIdentities, Z] - ): Insert[Source, Z] = Insert(table, sources.value, Seq(value)) - } - - sealed case class Insert[A, Z](table: Table.Source.Aux[A], sources: SelectionSet[A], values: Seq[Z])(implicit - schemaN: Schema[Z] - ) - - implicit def convertOptionToSome[A](implicit op: Schema[Option[A]]): Schema[Some[A]] = - op.transformOrFail[Some[A]]( - { - case Some(a) => Right(Some(a)) - case None => Left("cannot encode Right") - }, - someA => Right(someA) - ) - implicit val none: Schema[None.type] = Schema.singleton(None) -} diff --git a/core/jvm/src/main/scala/zio/sql/insert/Insert.scala b/core/jvm/src/main/scala/zio/sql/insert/Insert.scala new file mode 100644 index 000000000..7e9f7f640 --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/insert/Insert.scala @@ -0,0 +1,9 @@ +package zio.sql.insert + +import zio.schema.Schema +import zio.sql.table._ +import zio.sql.select._ + +final case class Insert[A, Z](table: Table.Source.Aux[A], sources: SelectionSet[A], values: Seq[Z])(implicit + schemaN: Schema[Z] +) \ No newline at end of file diff --git a/core/jvm/src/main/scala/zio/sql/insert/InsertBuilder.scala b/core/jvm/src/main/scala/zio/sql/insert/InsertBuilder.scala new file mode 100644 index 000000000..331e7d068 --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/insert/InsertBuilder.scala @@ -0,0 +1,22 @@ +package zio.sql.insert + +import zio.schema.Schema +import zio.sql.macros._ +import zio.sql.table._ +import zio.sql.select._ + +final case class InsertBuilder[F, Source, AllColumnIdentities, B <: SelectionSet[Source], ColsRepr]( + table: Table.Source.Aux_[Source, AllColumnIdentities], + sources: Selection.Aux[F, Source, B, ColsRepr] +) { + + def values[Z](values: Seq[Z])(implicit + schemaCC: Schema[Z], + schemaValidity: InsertLike[F, ColsRepr, AllColumnIdentities, Z] + ): Insert[Source, Z] = Insert(table, sources.value, values) + + def values[Z](value: Z)(implicit + schemaCC: Schema[Z], + schemaValidity: InsertLike[F, ColsRepr, AllColumnIdentities, Z] + ): Insert[Source, Z] = Insert(table, sources.value, Seq(value)) +} \ No newline at end of file diff --git a/core/jvm/src/main/scala/zio/sql/insert/InsertByCommaBuilder.scala b/core/jvm/src/main/scala/zio/sql/insert/InsertByCommaBuilder.scala new file mode 100644 index 000000000..051cfe6be --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/insert/InsertByCommaBuilder.scala @@ -0,0 +1,211 @@ +package zio.sql.insert + +import zio.sql.table._ +import zio.sql.expr.Expr +import zio.sql.select._ +import zio.sql.insert.InsertBuilder + +// format: off +final case class InsertByCommaBuilder[Source, AllColumnIdentities]( + table: Table.Source.Aux_[Source, AllColumnIdentities] +) { + + def apply[F, B <: SelectionSet[Source]](sources: Selection[F, Source, B]) = + InsertBuilder[F, Source, AllColumnIdentities, B, sources.ColsRepr](table, sources) + + def apply[F1, B1](expr1: Expr[F1, Source, B1]) = { + val selection: Selection[F1, Source, SelectionSet.Cons[Source, B1, SelectionSet.Empty]] = expr1 + + InsertBuilder[F1, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Empty], selection.ColsRepr](table, selection) + } + + def apply[F1, F2, B1, B2](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2]) = { + val selection = expr1 ++ expr2 + + InsertBuilder[F1 with F2, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Empty]], selection.ColsRepr]( + table, + selection + ) + } + + def apply[F1, F2, F3, B1, B2, B3](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3]) = { + val selection = expr1 ++ expr2 ++ expr3 + + InsertBuilder[F1 with F2 with F3, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Empty]]], selection.ColsRepr]( + table, + selection + ) + } + + def apply[F1, F2, F3, F4, B1, B2, B3, B4](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 + + InsertBuilder[F1 with F2 with F3 with F4, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Empty]]]], selection.ColsRepr]( + table, + selection + ) + } + + def apply[F1, F2, F3, F4, F5, B1, B2, B3, B4, B5](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 + + InsertBuilder[F1 with F2 with F3 with F4 with F5, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Empty]]]]], selection.ColsRepr]( + table, + selection + ) + } + + def apply[F1, F2, F3, F4, F5, F6, B1, B2, B3, B4, B5, B6](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 + + InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Empty]]]]]], selection.ColsRepr]( + table, + selection + ) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, B1, B2, B3, B4, B5, B6, B7](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 + + InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Empty]]]]]]], selection.ColsRepr]( + table, + selection + ) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, B1, B2, B3, B4, B5, B6, B7, B8](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 + + InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Empty]]]]]]]], selection.ColsRepr]( + table, + selection + ) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, B1, B2, B3, B4, B5, B6, B7, B8, B9](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 + + InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Empty]]]]]]]]], selection.ColsRepr]( + table, + selection + ) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 + + InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Empty]]]]]]]]]], selection.ColsRepr]( + table, + selection + ) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 + + InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Empty]]]]]]]]]]], selection.ColsRepr]( + table, + selection + ) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 + + InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Empty]]]]]]]]]]]], selection.ColsRepr]( + table, + selection + ) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 + + InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Empty]]]]]]]]]]]]], selection.ColsRepr]( + table, + selection + ) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 + + InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Empty]]]]]]]]]]]]]], selection.ColsRepr]( + table, + selection + ) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 + + InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Empty]]]]]]]]]]]]]]], selection.ColsRepr]( + table, + selection + ) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 + + InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Empty]]]]]]]]]]]]]]]], selection.ColsRepr]( + table, + selection + ) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 + + InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Empty]]]]]]]]]]]]]]]]], selection.ColsRepr]( + table, + selection + ) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 + + InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Empty]]]]]]]]]]]]]]]]]], selection.ColsRepr]( + table, + selection + ) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 + + InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Empty]]]]]]]]]]]]]]]]]]], selection.ColsRepr]( + table, + selection + ) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19, B20](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19], expr20: Expr[F20, Source, B20]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 ++ expr20 + + InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Cons[Source, B20, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]], selection.ColsRepr]( + table, + selection + ) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19, B20, B21](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19], expr20: Expr[F20, Source, B20], expr21: Expr[F21, Source, B21]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 ++ expr20 ++ expr21 + + InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Cons[Source, B20, SelectionSet.Cons[Source, B21, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]], selection.ColsRepr]( + table, + selection + ) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19, B20, B21, B22](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19], expr20: Expr[F20, Source, B20], expr21: Expr[F21, Source, B21], expr22: Expr[F22, Source, B22]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 ++ expr20 ++ expr21 ++ expr22 + + InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21 with F22, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Cons[Source, B20, SelectionSet.Cons[Source, B21, SelectionSet.Cons[Source, B22, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]]], selection.ColsRepr]( + table, + selection + ) + } +} +// format: on diff --git a/core/jvm/src/main/scala/zio/sql/insertutils.scala b/core/jvm/src/main/scala/zio/sql/insertutils.scala deleted file mode 100644 index 0dd2c4ee1..000000000 --- a/core/jvm/src/main/scala/zio/sql/insertutils.scala +++ /dev/null @@ -1,209 +0,0 @@ -package zio.sql - -// format: off -trait InsertUtilsModule { self: ExprModule with TableModule with InsertModule with SelectModule => - - sealed case class InsertIntoBuilder[Source, AllColumnIdentities]( - table: Table.Source.Aux_[Source, AllColumnIdentities] - ) { - - def apply[F, B <: SelectionSet[Source]](sources: Selection[F, Source, B]) = - InsertBuilder[F, Source, AllColumnIdentities, B, sources.ColsRepr](table, sources) - - def apply[F1, B1](expr1: Expr[F1, Source, B1]) = { - val selection: Selection[F1, Source, SelectionSet.Cons[Source, B1, SelectionSet.Empty]] = expr1 - - InsertBuilder[F1, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Empty], selection.ColsRepr](table, selection) - } - - def apply[F1, F2, B1, B2](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2]) = { - val selection = expr1 ++ expr2 - - InsertBuilder[F1 with F2, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Empty]], selection.ColsRepr]( - table, - selection - ) - } - - def apply[F1, F2, F3, B1, B2, B3](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3]) = { - val selection = expr1 ++ expr2 ++ expr3 - - InsertBuilder[F1 with F2 with F3, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Empty]]], selection.ColsRepr]( - table, - selection - ) - } - - def apply[F1, F2, F3, F4, B1, B2, B3, B4](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 - - InsertBuilder[F1 with F2 with F3 with F4, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Empty]]]], selection.ColsRepr]( - table, - selection - ) - } - - def apply[F1, F2, F3, F4, F5, B1, B2, B3, B4, B5](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 - - InsertBuilder[F1 with F2 with F3 with F4 with F5, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Empty]]]]], selection.ColsRepr]( - table, - selection - ) - } - - def apply[F1, F2, F3, F4, F5, F6, B1, B2, B3, B4, B5, B6](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 - - InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Empty]]]]]], selection.ColsRepr]( - table, - selection - ) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, B1, B2, B3, B4, B5, B6, B7](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 - - InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Empty]]]]]]], selection.ColsRepr]( - table, - selection - ) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, B1, B2, B3, B4, B5, B6, B7, B8](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 - - InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Empty]]]]]]]], selection.ColsRepr]( - table, - selection - ) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, B1, B2, B3, B4, B5, B6, B7, B8, B9](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 - - InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Empty]]]]]]]]], selection.ColsRepr]( - table, - selection - ) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 - - InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Empty]]]]]]]]]], selection.ColsRepr]( - table, - selection - ) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 - - InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Empty]]]]]]]]]]], selection.ColsRepr]( - table, - selection - ) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 - - InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Empty]]]]]]]]]]]], selection.ColsRepr]( - table, - selection - ) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 - - InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Empty]]]]]]]]]]]]], selection.ColsRepr]( - table, - selection - ) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 - - InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Empty]]]]]]]]]]]]]], selection.ColsRepr]( - table, - selection - ) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 - - InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Empty]]]]]]]]]]]]]]], selection.ColsRepr]( - table, - selection - ) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 - - InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Empty]]]]]]]]]]]]]]]], selection.ColsRepr]( - table, - selection - ) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 - - InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Empty]]]]]]]]]]]]]]]]], selection.ColsRepr]( - table, - selection - ) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 - - InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Empty]]]]]]]]]]]]]]]]]], selection.ColsRepr]( - table, - selection - ) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 - - InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Empty]]]]]]]]]]]]]]]]]]], selection.ColsRepr]( - table, - selection - ) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19, B20](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19], expr20: Expr[F20, Source, B20]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 ++ expr20 - - InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Cons[Source, B20, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]], selection.ColsRepr]( - table, - selection - ) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19, B20, B21](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19], expr20: Expr[F20, Source, B20], expr21: Expr[F21, Source, B21]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 ++ expr20 ++ expr21 - - InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Cons[Source, B20, SelectionSet.Cons[Source, B21, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]], selection.ColsRepr]( - table, - selection - ) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19, B20, B21, B22](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19], expr20: Expr[F20, Source, B20], expr21: Expr[F21, Source, B21], expr22: Expr[F22, Source, B22]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 ++ expr20 ++ expr21 ++ expr22 - - InsertBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21 with F22, Source, AllColumnIdentities, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Cons[Source, B20, SelectionSet.Cons[Source, B21, SelectionSet.Cons[Source, B22, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]]], selection.ColsRepr]( - table, - selection - ) - } - } -} -// format: on diff --git a/core/jvm/src/main/scala/zio/sql/newtypes.scala b/core/jvm/src/main/scala/zio/sql/newtypes.scala deleted file mode 100644 index 2ebc986c3..000000000 --- a/core/jvm/src/main/scala/zio/sql/newtypes.scala +++ /dev/null @@ -1,10 +0,0 @@ -package zio.sql - -trait NewtypesModule { - - type ColumnName = String - // TODO we could use zio-prelude new types - type TableName = String - - sealed case class FunctionName(name: String) -} diff --git a/core/jvm/src/main/scala/zio/sql/ops.scala b/core/jvm/src/main/scala/zio/sql/ops/Operator.scala similarity index 79% rename from core/jvm/src/main/scala/zio/sql/ops.scala rename to core/jvm/src/main/scala/zio/sql/ops/Operator.scala index d1ad515e7..9744cf0a9 100644 --- a/core/jvm/src/main/scala/zio/sql/ops.scala +++ b/core/jvm/src/main/scala/zio/sql/ops/Operator.scala @@ -1,27 +1,12 @@ -package zio.sql +package zio.sql.ops -trait OpsModule extends TypeTagModule { self: SelectModule => +import zio.sql.typetag._ - sealed trait Operator { - val symbol: String - } - sealed trait UnaryOp[A] extends Operator - - object UnaryOp { - sealed case class Negate[A: IsNumeric]() extends UnaryOp[A] { - def isNumeric: IsNumeric[A] = implicitly[IsNumeric[A]] - val symbol = "-" - } - - sealed case class NotBit[A: IsIntegral]() extends UnaryOp[A] { - def isIntegral: IsIntegral[A] = implicitly[IsIntegral[A]] - val symbol = "~" - } +trait Operator { + val symbol: String +} - case object NotBool extends UnaryOp[Boolean] { - val symbol = "not" - } - } +object Operator { sealed trait BinaryOp[A] extends Operator { val symbol: String @@ -29,25 +14,25 @@ trait OpsModule extends TypeTagModule { self: SelectModule => object BinaryOp { - sealed case class Add[A: IsNumeric]() extends BinaryOp[A] { + final case class Add[A: IsNumeric]() extends BinaryOp[A] { def isNumeric: IsNumeric[A] = implicitly[IsNumeric[A]] override val symbol: String = "+" } - sealed case class Sub[A: IsNumeric]() extends BinaryOp[A] { + final case class Sub[A: IsNumeric]() extends BinaryOp[A] { def isNumeric: IsNumeric[A] = implicitly[IsNumeric[A]] override val symbol: String = "-" } - sealed case class Mul[A: IsNumeric]() extends BinaryOp[A] { + final case class Mul[A: IsNumeric]() extends BinaryOp[A] { def isNumeric: IsNumeric[A] = implicitly[IsNumeric[A]] override val symbol: String = "*" } - sealed case class Div[A: IsNumeric]() extends BinaryOp[A] { + final case class Div[A: IsNumeric]() extends BinaryOp[A] { def isNumeric: IsNumeric[A] = implicitly[IsNumeric[A]] override val symbol: String = "/" @@ -60,11 +45,11 @@ trait OpsModule extends TypeTagModule { self: SelectModule => override val symbol: String = "or" } - sealed case class AndBit[A: IsIntegral]() extends BinaryOp[A] { + final case class AndBit[A: IsIntegral]() extends BinaryOp[A] { def isIntegral: IsIntegral[A] = implicitly[IsIntegral[A]] override val symbol: String = "&" } - sealed case class OrBit[A: IsIntegral]() extends BinaryOp[A] { + final case class OrBit[A: IsIntegral]() extends BinaryOp[A] { def isIntegral: IsIntegral[A] = implicitly[IsIntegral[A]] override val symbol: String = "|" @@ -114,4 +99,22 @@ trait OpsModule extends TypeTagModule { self: SelectModule => } } + sealed trait UnaryOp[A] extends Operator + + object UnaryOp { + final case class Negate[A: IsNumeric]() extends UnaryOp[A] { + def isNumeric: IsNumeric[A] = implicitly[IsNumeric[A]] + val symbol = "-" + } + + final case class NotBit[A: IsIntegral]() extends UnaryOp[A] { + def isIntegral: IsIntegral[A] = implicitly[IsIntegral[A]] + val symbol = "~" + } + + case object NotBool extends UnaryOp[Boolean] { + val symbol = "not" + } + } + } diff --git a/core/jvm/src/main/scala/zio/sql/package.scala b/core/jvm/src/main/scala/zio/sql/package.scala new file mode 100644 index 000000000..cca1c1524 --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/package.scala @@ -0,0 +1,12 @@ +package zio + +import zio.sql.expr.Expr + +package object sql { + + type Lens[F, S, A] = Expr[Features.Source[F, S], S, A] + + type Prism[F, S, A] = Unit + + type Traversal[S, A] = Unit +} diff --git a/core/jvm/src/main/scala/zio/sql/select.scala b/core/jvm/src/main/scala/zio/sql/select.scala deleted file mode 100644 index 7cabd40c5..000000000 --- a/core/jvm/src/main/scala/zio/sql/select.scala +++ /dev/null @@ -1,595 +0,0 @@ -package zio.sql - -import zio.sql.macros._ -import scala.language.implicitConversions - -trait SelectModule { self: ExprModule with TableModule with UtilsModule => - - sealed case class SelectBuilder[F0, Source, B <: SelectionSet[Source]](selection: Selection[F0, Source, B]) { - - def from[Source0 <: Source](table: Table.Aux[Source0])(implicit - ev: B <:< SelectionSet.Cons[Source0, selection.value.ColumnHead, selection.value.SelectionTail], - normalizer: Normalizer[selection.value.ResultTypeRepr] - ): Read.Select[ - F0, - normalizer.Out, - Source0, - selection.value.ColumnHead, - selection.value.SelectionTail - ] = { - type B0 = SelectionSet.ConsAux[ - selection.value.ResultTypeRepr, - Source0, - selection.value.ColumnHead, - selection.value.SelectionTail - ] - val b: B0 = selection.value.asInstanceOf[B0] - - Read.Subselect(Selection[F0, Source0, B0](b), Some(table), true).normalize - } - } - - object SelectBuilder { - - implicit def noTable[F, Source >: Any, B <: SelectionSet[Source]]( - builder: SelectBuilder[F, Source, B] - )(implicit - ev: B <:< SelectionSet.Cons[ - Source, - builder.selection.value.ColumnHead, - builder.selection.value.SelectionTail - ], - normalizer: Normalizer[builder.selection.value.ResultTypeRepr] - ): Read.Select[ - F, - normalizer.Out, - Source, - builder.selection.value.ColumnHead, - builder.selection.value.SelectionTail - ] = { - type B0 = SelectionSet.ConsAux[ - builder.selection.value.ResultTypeRepr, - Source, - builder.selection.value.ColumnHead, - builder.selection.value.SelectionTail - ] - val b: B0 = builder.selection.value.asInstanceOf[B0] - - Read.Subselect(Selection[F, Source, B0](b), None, true).normalize - } - } - - sealed case class SubselectBuilder[F, Source, B <: SelectionSet[Source], ParentTable]( - selection: Selection[F, Source, B] - ) { - def from[Source0](table: Table.Aux[Source0])(implicit - ev1: Source0 with ParentTable <:< Source, - ev2: B <:< SelectionSet.Cons[Source, selection.value.ColumnHead, selection.value.SelectionTail], - normalizer: Normalizer[selection.value.ResultTypeRepr] - ): Read.Subselect[ - F, - normalizer.Out, - Source with ParentTable, - Source0, - selection.value.ColumnHead, - selection.value.SelectionTail - ] = { - type B0 = SelectionSet.ConsAux[ - selection.value.ResultTypeRepr, - Source with ParentTable, - selection.value.ColumnHead, - selection.value.SelectionTail - ] - val b: B0 = selection.value.asInstanceOf[B0] - - Read.Subselect(Selection[F, Source with ParentTable, B0](b), Some(table), true).normalize - } - } - - /** - * A `Read[A]` models a selection of a set of values of type `A`. - */ - sealed trait Read[+Out] { self => - type ResultType - - val mapper: ResultType => Out - - type ColumnsOut - - type TableSource - - def columns(name: TableName): ColumnsOut - - /** - * Maps the [[Read]] query's output to another type by providing a function - * that can transform from the current type to the new type. - */ - def map[Out2](f: Out => Out2): Read.Aux[ResultType, Out2] = - Read.Mapped(self, f) - - def asTable( - name: TableName - ): Table.DerivedTable[ColumnsOut, Out, Read[Out] { type ColumnsOut = self.ColumnsOut }, TableSource] - - def to[Target](f: Out => Target): Read[Target] = - self.map { resultType => - f(resultType) - } - - def union[Out1 >: Out](that: Read.Aux[ResultType, Out1]): Read.Aux[ResultType, Out1] = - Read.Union[ResultType, Out1](self, that, true) - - def unionAll[Out1 >: Out](that: Read.Aux[ResultType, Out1]): Read.Aux[ResultType, Out1] = - Read.Union[ResultType, Out1](self, that, false) - } - - object Read { - sealed trait ExprSet[-Source] { - type Append[F2, Source1 <: Source, B2] <: ExprSet[Source1] - def ++[F2, Source1 <: Source, B2](that: Expr[F2, Source1, B2]): Append[F2, Source1, B2] - } - - object ExprSet { - type NoExpr = NoExpr.type - case object NoExpr extends ExprSet[Any] { - override type Append[F2, Source1 <: Any, B2] = ExprCons[F2, Source1, B2, NoExpr] - - override def ++[F2, Source1 <: Any, B2](that: Expr[F2, Source1, B2]): Append[F2, Source1, B2] = - ExprCons(that, NoExpr) - } - - sealed case class ExprCons[F, Source, B, T <: ExprSet[Source]](head: Expr[F, Source, B], tail: T) - extends ExprSet[Source] { - override type Append[F2, Source1 <: Source, B2] = - ExprCons[F, Source1, B, tail.Append[F2, Source1, B2]] - override def ++[F2, Source1 <: Source, B2](that: Expr[F2, Source1, B2]): Append[F2, Source1, B2] = - ExprCons(head, tail.++[F2, Source1, B2](that)) - } - } - - type WithReprs[+Out, Reprs] = Read[Out] { - type ColumnsOut = Reprs - } - - type Aux[ResultType0, Out] = Read[Out] { - type ResultType = ResultType0 - } - - sealed case class Mapped[Repr, Out, Out2](read: Read.Aux[Repr, Out], f: Out => Out2) extends Read[Out2] { self => - override type ResultType = Repr - - override val mapper = read.mapper.andThen(f) - - override type TableSource = read.TableSource - - override type ColumnsOut = read.ColumnsOut - override def columns(name: TableName): ColumnsOut = read.columns(name) - - override def asTable(name: TableName): Table.DerivedTable[read.ColumnsOut, Out2, Mapped[ - Repr, - Out, - Out2 - ] { type ColumnsOut = self.ColumnsOut }, read.TableSource] = - Table.DerivedTable[self.ColumnsOut, Out2, Mapped[ - Repr, - Out, - Out2 - ] { type ColumnsOut = self.ColumnsOut }, read.TableSource]( - self, - name - ) - } - - type Select[F, Repr, Source, Head, Tail <: SelectionSet[Source]] = Subselect[F, Repr, Source, Source, Head, Tail] - - sealed case class Subselect[F, Repr, Source, Subsource, Head, Tail <: SelectionSet[Source]]( - selection: Selection[F, Source, SelectionSet.ConsAux[Repr, Source, Head, Tail]], - table: Option[Table.Aux[Subsource]], - whereExpr: Expr[_, Source, Boolean], - groupByExprs: ExprSet[Source] = ExprSet.NoExpr, - havingExpr: Expr[_, Source, Boolean] = true, - orderByExprs: List[Ordering[Expr[_, Source, Any]]] = Nil, - offset: Option[Long] = None, // todo don't know how to do this outside of postgres/mysql - limit: Option[Long] = None - ) extends Read[Repr] { self => - - type GroupByF <: Any - - def where[F2]( - whereExpr2: Expr[F2, Source, Boolean] - )(implicit - ev: WhereIsSound[F2, self.GroupByF] - ): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF] = - new Subselect( - selection, - table, - self.whereExpr && whereExpr2, - groupByExprs, - havingExpr, - orderByExprs, - offset, - limit - ) { - override type GroupByF = self.GroupByF - } - - def limit(n: Long): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF] = - new Subselect(selection, table, whereExpr, groupByExprs, havingExpr, orderByExprs, offset, Some(n)) { - override type GroupByF = self.GroupByF - } - - def offset(n: Long): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF] = - new Subselect(selection, table, whereExpr, groupByExprs, havingExpr, orderByExprs, Some(n), limit) { - override type GroupByF = self.GroupByF - } - - def orderBy( - o: Ordering[Expr[_, Source, Any]], - os: Ordering[Expr[_, Source, Any]]* - ): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF] = - new Subselect( - selection, - table, - whereExpr, - groupByExprs, - havingExpr, - self.orderByExprs ++ (o :: os.toList), - offset, - limit - ) { - override type GroupByF = self.GroupByF - } - - def having[F2]( - havingExpr2: Expr[F2, Source, Boolean] - )(implicit - ev: HavingIsSound[F, self.GroupByF, F2] - ): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF] = - new Subselect( - selection, - table, - whereExpr, - groupByExprs, - self.havingExpr && havingExpr2, - orderByExprs, - offset, - limit - ) { - override type GroupByF = self.GroupByF - } - - //format: off - def groupBy[F1](expr1: Expr[F1, Source, Any])(implicit verify: GroupByLike[F, F1]): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF with F1] = - new Subselect[F, Repr, Source, Subsource, Head, Tail](selection, table, whereExpr, self.groupByExprs ++ expr1, havingExpr, orderByExprs, offset, limit) { - override type GroupByF = self.GroupByF with F1 - } - - def groupBy[F1, F2](expr1: Expr[F1, Source, Any], expr2: Expr[F2, Source, Any])(implicit verify: GroupByLike[F, F1 with F2]): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF with F1 with F2] = - new Subselect[F, Repr, Source, Subsource, Head, Tail](selection, table, whereExpr, self.groupByExprs ++ expr1 ++ expr2, havingExpr, orderByExprs, offset, limit) { - override type GroupByF = self.GroupByF with F1 with F2 - } - - def groupBy[F1, F2, F3](expr1: Expr[F1, Source, Any], expr2: Expr[F2, Source, Any], expr3: Expr[F3, Source, Any])(implicit verify: GroupByLike[F, F1 with F2 with F3]): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF with F1 with F2 with F3] = - new Subselect[F, Repr, Source, Subsource, Head, Tail](selection, table, whereExpr,self.groupByExprs ++ expr1 ++ expr2 ++ expr3, havingExpr, orderByExprs, offset, limit) { - override type GroupByF = self.GroupByF with F1 with F2 with F3 - } - - def groupBy[F1, F2, F3, F4](expr1: Expr[F1, Source, Any], expr2: Expr[F2, Source, Any], expr3: Expr[F3, Source, Any], expr4: Expr[F4, Source, Any])(implicit verify: GroupByLike[F, F1 with F2 with F3 with F4]): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF with F1 with F2 with F3 with F4] = - new Subselect[F, Repr, Source, Subsource, Head, Tail](selection, table, whereExpr, self.groupByExprs ++ expr1 ++ expr2 ++ expr3 ++ expr4, havingExpr, orderByExprs, offset, limit) { - override type GroupByF = self.GroupByF with F1 with F2 with F3 with F4 - } - - def groupBy[F1, F2, F3, F4, F5](expr1: Expr[F1, Source, Any], expr2: Expr[F2, Source, Any], expr3: Expr[F3, Source, Any], expr4: Expr[F4, Source, Any], expr5: Expr[F5, Source, Any])(implicit verify: GroupByLike[F, F1 with F2 with F3 with F4 with F5]): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF with F1 with F2 with F3 with F4 with F5] = - new Subselect[F, Repr, Source, Subsource, Head, Tail](selection, table, whereExpr, self.groupByExprs ++ expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5, havingExpr, orderByExprs, offset, limit) { - override type GroupByF = self.GroupByF with F1 with F2 with F3 with F4 with F5 - } - - def groupBy[F1, F2, F3, F4, F5, F6](expr1: Expr[F1, Source, Any], expr2: Expr[F2, Source, Any], expr3: Expr[F3, Source, Any], expr4: Expr[F4, Source, Any], expr5: Expr[F5, Source, Any], expr6: Expr[F6, Source, Any])(implicit verify: GroupByLike[F, F1 with F2 with F3 with F4 with F5 with F6]): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF with F1 with F2 with F3 with F4 with F5 with F6] = - new Subselect[F, Repr, Source, Subsource, Head, Tail](selection, table, whereExpr, self.groupByExprs ++ expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6, havingExpr, orderByExprs, offset, limit) { - override type GroupByF = self.GroupByF with F1 with F2 with F3 with F4 with F5 with F6 - } - - //TODO add arities up to 22 if needed - def groupBy[F1, F2, F3, F4, F5, F6, F7](expr1: Expr[F1, Source, Any], expr2: Expr[F2, Source, Any], expr3: Expr[F3, Source, Any], expr4: Expr[F4, Source, Any], expr5: Expr[F5, Source, Any], expr6: Expr[F6, Source, Any], expr7: Expr[F7, Source, Any])(implicit verify: GroupByLike[F, F1 with F2 with F3 with F4 with F5 with F6 with F7]): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF with F1 with F2 with F3 with F4 with F5 with F6 with F7] = - new Subselect[F, Repr, Source, Subsource, Head, Tail](selection, table, whereExpr, self.groupByExprs ++ expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7, havingExpr, orderByExprs, offset, limit) { - override type GroupByF = self.GroupByF with F1 with F2 with F3 with F4 with F5 with F6 with F7 - } - //format: on - - def normalize(implicit - instance: Normalizer[ResultType] - ): Subselect[F, instance.Out, Source, Subsource, Head, Tail] = - self.asInstanceOf[Subselect[F, instance.Out, Source, Subsource, Head, Tail]] - - override def asTable( - name: TableName - ): Table.DerivedTable[selection.ColumnsOut[Source], Repr, Subselect[ - F, - Repr, - Source, - Subsource, - Head, - Tail - ] { type ColumnsOut = self.ColumnsOut }, Source] = - Table.DerivedTable[self.ColumnsOut, Repr, Subselect[ - F, - Repr, - Source, - Subsource, - Head, - Tail - ] { type ColumnsOut = self.ColumnsOut }, Source](self, name) - - override type ResultType = Repr - - override type TableSource = Source - - override val mapper: Repr => Repr = identity(_) - - override type ColumnsOut = selection.ColumnsOut[Source] - override def columns(name: TableName) = selection.columns[Source](name) - } - - object Subselect { - - type WithGroupByF[F, Repr, Source, Subsource, Head, Tail <: SelectionSet[Source], GroupByF0] = - Subselect[F, Repr, Source, Subsource, Head, Tail] { - type GroupByF = GroupByF0 - } - - implicit def subselectToExpr[F <: Features.Aggregated[_], Repr, Source, Subsource, Head]( - subselect: Read.Subselect[F, Repr, _ <: Source, Subsource, Head, SelectionSet.Empty] - ): Expr[Features.Derived, Any, Head] = - Expr.Subselect(subselect) - } - - sealed case class Union[Repr, Out](left: Read.Aux[Repr, Out], right: Read.Aux[Repr, Out], distinct: Boolean) - extends Read[Out] { self => - override type ResultType = Repr - - override val mapper: ResultType => Out = left.mapper - - override type ColumnsOut = left.ColumnsOut - - override type TableSource = left.TableSource - - override def columns(name: TableName): ColumnsOut = left.columns(name) - - override def asTable(name: TableName): Table.DerivedTable[left.ColumnsOut, Out, Union[ - Repr, - Out - ] { type ColumnsOut = self.ColumnsOut }, left.TableSource] = - Table - .DerivedTable[self.ColumnsOut, Out, Union[Repr, Out] { type ColumnsOut = self.ColumnsOut }, left.TableSource]( - self, - name - ) - } - - sealed case class Literal[B: TypeTag](values: Iterable[B]) extends Read[B] { self => - override type ResultType = B - - override val mapper: ResultType => B = identity(_) - - type ColumnIdentity - - def typeTag: TypeTag[B] = implicitly[TypeTag[B]] - - override type ColumnsOut = Expr[Features.Source[ColumnIdentity, Any], Any, B] - override def columns(name: TableName) = Expr.Source(name, Column.Indexed[B, ColumnIdentity]()) - - override type TableSource = Any - - override def asTable( - name: TableName - ): Table.DerivedTable[Expr[Features.Source[ColumnIdentity, Any], Any, B], B, Literal[ - B - ] { type ColumnsOut = self.ColumnsOut }, Any] = - Table.DerivedTable[Expr[Features.Source[ColumnIdentity, Any], Any, B], B, Literal[ - B - ] { type ColumnsOut = self.ColumnsOut }, Any](self, name) - } - - implicit def seqToLiteral[B](values: Seq[B])(implicit typeTag: TypeTag[B]): Read[B] = - Read.Literal[B](values) - - } - - /** - * A columnar selection of `B` from a source `A`, modeled as `A => B`. - */ - sealed case class Selection[F, -A, +B <: SelectionSet[A]](value: B) { self => - - type ColsRepr = value.ResultTypeRepr - - type ColumnsOut[S] = value.ColumnsOut[S] - - def columns[S](name: TableName): ColumnsOut[S] = value.columns[S](name) - - def ++[F2, A1 <: A, C <: SelectionSet[A1]]( - that: Selection[F2, A1, C] - ): Selection[F with F2, A1, self.value.Append[A1, C]] = - Selection(self.value ++ that.value) - } - - object Selection { - import ColumnSelection._ - import SelectionSet.{ Cons, Empty } - - type Aux[F, -A, +B <: SelectionSet[A], ColsRepr0] = Selection[F, A, B] { - type ColsRepr = ColsRepr0 - } - - def constantOption[A: TypeTag](value: A, option: Option[ColumnName]): Selection[Any, Any, Cons[Any, A, Empty]] = - Selection(Cons(Constant(value, option), Empty)) - - def constant[A: TypeTag](value: A): Selection[Any, Any, Cons[Any, A, Empty]] = constantOption(value, None) - - def constantAs[A: TypeTag](value: A, name: ColumnName): Selection[Any, Any, Cons[Any, A, Empty]] = - constantOption(value, Some(name)) - - def computedOption[F, A, B](expr: Expr[F, A, B], name: Option[ColumnName]): Selection[F, A, Cons[A, B, Empty]] = - Selection(Cons(Computed(expr, name), Empty)) - - def computed[F, A, B](expr: Expr[F, A, B]): Selection[F, A, Cons[A, B, Empty]] = - computedOption(expr, None) - - def computedAs[F, A, B](expr: Expr[F, A, B], name: ColumnName): Selection[F, A, Cons[A, B, Empty]] = - computedOption(expr, Some(name)) - } - - sealed trait ColumnSelection[-Source, +ColumnType] { - type ColumnType0 <: ColumnType - - def name: Option[ColumnName] - - val toColumn: Column[ColumnType] - } - - object ColumnSelection { - sealed case class Constant[ColumnType: TypeTag](value: ColumnType, name: Option[ColumnName]) - extends ColumnSelection[Any, ColumnType] { - def typeTag: TypeTag[ColumnType] = implicitly[TypeTag[ColumnType]] - - val toColumn: Column[ColumnType] = name match { - case Some(value) => Column.Named(value) - case None => Column.Indexed() - } - } - - sealed case class Computed[F, Source, ColumnType](expr: Expr[F, Source, ColumnType], name: Option[ColumnName]) - extends ColumnSelection[Source, ColumnType] { - implicit def typeTag: TypeTag[ColumnType] = Expr.typeTagOf(expr) - - val toColumn: Column[ColumnType] = name match { - case Some(value) => Column.Named(value) - case None => Column.Indexed() - } - } - } - - sealed trait SelectionSet[-Source] { - type SelectionsRepr[Source1, T] - - type ResultTypeRepr - - type Append[Source1, That <: SelectionSet[Source1]] <: SelectionSet[Source1] - - type ColumnHead - - type SelectionTail <: SelectionSet[Source] - type HeadIdentity - - type ColumnsOut[S] - - def columns[S](name: TableName): ColumnsOut[S] - - def ++[Source1 <: Source, That <: SelectionSet[Source1]](that: That): Append[Source1, That] - - def selectionsUntyped: List[ColumnSelection[Source, _]] - - def selections[Source1 <: Source, T]: SelectionsRepr[Source1, T] - } - - object SelectionSet { - - type Aux[-Source, ResultTypeRepr0] = - SelectionSet[Source] { - type ResultTypeRepr = ResultTypeRepr0 - } - - type ConsAux[ResultTypeRepr0, -Source, A, B <: SelectionSet[Source]] = - SelectionSet.Cons[Source, A, B] { - type ResultTypeRepr = ResultTypeRepr0 - } - - type Empty = Empty.type - - case object Empty extends SelectionSet[Any] { - - override type ColumnHead = Unit - override type SelectionTail = SelectionSet.Empty - - override type HeadIdentity = Any - - override type SelectionsRepr[Source1, T] = Unit - - override type ResultTypeRepr = Unit - - override type Append[Source1, That <: SelectionSet[Source1]] = That - - override type ColumnsOut[S] = Unit - - override def columns[S](name: TableName): ColumnsOut[S] = () - - override def ++[Source1 <: Any, That <: SelectionSet[Source1]](that: That): Append[Source1, That] = - that - - override def selectionsUntyped: List[ColumnSelection[Any, _]] = Nil - - override def selections[Source1 <: Any, T]: SelectionsRepr[Source1, T] = () - } - - sealed case class Cons[-Source, A, B <: SelectionSet[Source]](head: ColumnSelection[Source, A], tail: B) - extends SelectionSet[Source] { self => - - override type ColumnHead = A - override type SelectionTail = B - - override type HeadIdentity = head.toColumn.Identity - - override type SelectionsRepr[Source1, T] = (ColumnSelection[Source1, A], tail.SelectionsRepr[Source1, T]) - - override type ResultTypeRepr = (A, tail.ResultTypeRepr) - - override type Append[Source1, That <: SelectionSet[Source1]] = - Cons[Source1, A, tail.Append[Source1, That]] - - override type ColumnsOut[S] = (Expr[Features.Source[HeadIdentity, S], S, A], tail.ColumnsOut[S]) - - override def columns[S](name: TableName): ColumnsOut[S] = { - val column: Column.Aux[A, HeadIdentity] = head.toColumn - - (Expr.Source(name, column), tail.columns[S](name)) - } - - override def ++[Source1 <: Source, That <: SelectionSet[Source1]](that: That): Append[Source1, That] = - Cons[Source1, A, tail.Append[Source1, That]](head, tail ++ that) - - override def selectionsUntyped: List[ColumnSelection[Source, _]] = head :: tail.selectionsUntyped - - override def selections[Source1 <: Source, T]: SelectionsRepr[Source1, T] = (head, tail.selections[Source1, T]) - } - } - - sealed trait Ordering[+A] { - val value: A - } - - object Ordering { - sealed case class Asc[A](value: A) extends Ordering[A] - sealed case class Desc[A](value: A) extends Ordering[A] - - implicit def exprToOrdering[F, A, B](expr: Expr[F, A, B]): Ordering[Expr[F, A, B]] = - Asc(expr) - } - - sealed trait DecodingError extends Exception { - def message: String - } - - object DecodingError { - sealed case class UnexpectedNull(column: Int) extends DecodingError { - def message = s"Expected column with index ${column} to be non-null" - } - sealed case class UnexpectedType(expected: TypeTag[_], actual: Int) extends DecodingError { - def message = s"Expected type ${expected} but found ${actual}" - } - sealed case class MissingColumn(column: Int) extends DecodingError { - def message = s"The column with index ${column} does not exist" - } - case object Closed extends DecodingError { - def message = s"The ResultSet has been closed, so decoding is impossible" - } - } -} diff --git a/core/jvm/src/main/scala/zio/sql/select/ColumnSelection.scala b/core/jvm/src/main/scala/zio/sql/select/ColumnSelection.scala new file mode 100644 index 000000000..b6431cdbc --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/select/ColumnSelection.scala @@ -0,0 +1,36 @@ +package zio.sql.select + +import zio.sql.table.Column +import zio.sql.typetag.TypeTag +import zio.sql.expr.Expr + +sealed trait ColumnSelection[-Source, +ColumnType] { + type ColumnType0 <: ColumnType + + def name: Option[String] + + val toColumn: Column[ColumnType] +} + + +object ColumnSelection { + final case class Constant[ColumnType: TypeTag](value: ColumnType, name: Option[String]) + extends ColumnSelection[Any, ColumnType] { + def typeTag: TypeTag[ColumnType] = implicitly[TypeTag[ColumnType]] + + val toColumn: Column[ColumnType] = name match { + case Some(value) => Column.Named(value) + case None => Column.Indexed() + } + } + + final case class Computed[F, Source, ColumnType](expr: Expr[F, Source, ColumnType], name: Option[String]) + extends ColumnSelection[Source, ColumnType] { + implicit def typeTag: TypeTag[ColumnType] = Expr.typeTagOf(expr) + + val toColumn: Column[ColumnType] = name match { + case Some(value) => Column.Named(value) + case None => Column.Indexed() + } + } +} \ No newline at end of file diff --git a/core/jvm/src/main/scala/zio/sql/select/DecodingError.scala b/core/jvm/src/main/scala/zio/sql/select/DecodingError.scala new file mode 100644 index 000000000..4585547ac --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/select/DecodingError.scala @@ -0,0 +1,22 @@ +package zio.sql.select + +import zio.sql.typetag._ + +sealed trait DecodingError extends Exception { + def message: String +} + +object DecodingError { + final case class UnexpectedNull(column: Int) extends DecodingError { + def message = s"Expected column with index ${column} to be non-null" + } + final case class UnexpectedType(expected: TypeTag[_], actual: Int) extends DecodingError { + def message = s"Expected type ${expected} but found ${actual}" + } + final case class MissingColumn(column: Int) extends DecodingError { + def message = s"The column with index ${column} does not exist" + } + case object Closed extends DecodingError { + def message = s"The ResultSet has been closed, so decoding is impossible" + } +} \ No newline at end of file diff --git a/core/jvm/src/main/scala/zio/sql/select/Ordering.scala b/core/jvm/src/main/scala/zio/sql/select/Ordering.scala new file mode 100644 index 000000000..5291f6e67 --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/select/Ordering.scala @@ -0,0 +1,16 @@ +package zio.sql.select + +import zio.sql.expr.Expr +import scala.language.implicitConversions + +sealed trait Ordering[+A] { + val value: A +} + +object Ordering { + final case class Asc[A](value: A) extends Ordering[A] + final case class Desc[A](value: A) extends Ordering[A] + + implicit def exprToOrdering[F, A, B](expr: Expr[F, A, B]): Ordering[Expr[F, A, B]] = + Asc(expr) +} \ No newline at end of file diff --git a/core/jvm/src/main/scala/zio/sql/select/Read.scala b/core/jvm/src/main/scala/zio/sql/select/Read.scala new file mode 100644 index 000000000..0d8664d74 --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/select/Read.scala @@ -0,0 +1,317 @@ +package zio.sql.select + +import zio.sql.macros._ +import zio.sql.Features +import zio.sql.table._ +import scala.language.implicitConversions + +import zio.sql.typetag.TypeTag +import zio.sql.expr.Expr + +/** + * A `Read[A]` models a selection of a set of values of type `A`. + */ +sealed trait Read[+Out] { self => + type ResultType + + val mapper: ResultType => Out + + type ColumnsOut + + type TableSource + + def columns(name: String): ColumnsOut + + /** + * Maps the [[Read]] query's output to another type by providing a function + * that can transform from the current type to the new type. + */ + def map[Out2](f: Out => Out2): Read.Aux[ResultType, Out2] = + Read.Mapped(self, f) + + def asTable( + name: String + ): Table.DerivedTable[ColumnsOut, Out, Read[Out] { type ColumnsOut = self.ColumnsOut }, TableSource] + + def to[Target](f: Out => Target): Read[Target] = + self.map { resultType => + f(resultType) + } + + def union[Out1 >: Out](that: Read.Aux[ResultType, Out1]): Read.Aux[ResultType, Out1] = + Read.Union[ResultType, Out1](self, that, true) + + def unionAll[Out1 >: Out](that: Read.Aux[ResultType, Out1]): Read.Aux[ResultType, Out1] = + Read.Union[ResultType, Out1](self, that, false) +} + +object Read { + sealed trait ExprSet[-Source] { + type Append[F2, Source1 <: Source, B2] <: ExprSet[Source1] + def ++[F2, Source1 <: Source, B2](that: Expr[F2, Source1, B2]): Append[F2, Source1, B2] + } + + object ExprSet { + type NoExpr = NoExpr.type + case object NoExpr extends ExprSet[Any] { + override type Append[F2, Source1 <: Any, B2] = ExprCons[F2, Source1, B2, NoExpr] + + override def ++[F2, Source1 <: Any, B2](that: Expr[F2, Source1, B2]): Append[F2, Source1, B2] = + ExprCons(that, NoExpr) + } + + final case class ExprCons[F, Source, B, T <: ExprSet[Source]](head: Expr[F, Source, B], tail: T) + extends ExprSet[Source] { + override type Append[F2, Source1 <: Source, B2] = + ExprCons[F, Source1, B, tail.Append[F2, Source1, B2]] + override def ++[F2, Source1 <: Source, B2](that: Expr[F2, Source1, B2]): Append[F2, Source1, B2] = + ExprCons(head, tail.++[F2, Source1, B2](that)) + } + } + + type WithReprs[+Out, Reprs] = Read[Out] { + type ColumnsOut = Reprs + } + + type Aux[ResultType0, Out] = Read[Out] { + type ResultType = ResultType0 + } + + final case class Mapped[Repr, Out, Out2](read: Read.Aux[Repr, Out], f: Out => Out2) extends Read[Out2] { self => + override type ResultType = Repr + + override val mapper = read.mapper.andThen(f) + + override type TableSource = read.TableSource + + override type ColumnsOut = read.ColumnsOut + override def columns(name: String): ColumnsOut = read.columns(name) + + override def asTable(name: String): Table.DerivedTable[read.ColumnsOut, Out2, Mapped[ + Repr, + Out, + Out2 + ] { type ColumnsOut = self.ColumnsOut }, read.TableSource] = + Table.DerivedTable[self.ColumnsOut, Out2, Mapped[ + Repr, + Out, + Out2 + ] { type ColumnsOut = self.ColumnsOut }, read.TableSource]( + self, + name + ) + } + + type Select[F, Repr, Source, Head, Tail <: SelectionSet[Source]] = Subselect[F, Repr, Source, Source, Head, Tail] + + sealed case class Subselect[F, Repr, Source, Subsource, Head, Tail <: SelectionSet[Source]]( + selection: Selection[F, Source, SelectionSet.ConsAux[Repr, Source, Head, Tail]], + table: Option[Table.Aux[Subsource]], + whereExpr: Expr[_, Source, Boolean], + groupByExprs: ExprSet[Source] = ExprSet.NoExpr, + havingExpr: Expr[_, Source, Boolean] = true, + orderByExprs: List[Ordering[Expr[_, Source, Any]]] = Nil, + offset: Option[Long] = None, // todo don't know how to do this outside of postgres/mysql + limit: Option[Long] = None + ) extends Read[Repr] { self => + + type GroupByF <: Any + + def where[F2]( + whereExpr2: Expr[F2, Source, Boolean] + )(implicit + ev: WhereIsSound[F2, self.GroupByF] + ): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF] = + new Subselect( + selection, + table, + self.whereExpr && whereExpr2, + groupByExprs, + havingExpr, + orderByExprs, + offset, + limit + ) { + override type GroupByF = self.GroupByF + } + + def limit(n: Long): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF] = + new Subselect(selection, table, whereExpr, groupByExprs, havingExpr, orderByExprs, offset, Some(n)) { + override type GroupByF = self.GroupByF + } + + def offset(n: Long): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF] = + new Subselect(selection, table, whereExpr, groupByExprs, havingExpr, orderByExprs, Some(n), limit) { + override type GroupByF = self.GroupByF + } + + def orderBy( + o: Ordering[Expr[_, Source, Any]], + os: Ordering[Expr[_, Source, Any]]* + ): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF] = + new Subselect( + selection, + table, + whereExpr, + groupByExprs, + havingExpr, + self.orderByExprs ++ (o :: os.toList), + offset, + limit + ) { + override type GroupByF = self.GroupByF + } + + def having[F2]( + havingExpr2: Expr[F2, Source, Boolean] + )(implicit + ev: HavingIsSound[F, self.GroupByF, F2] + ): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF] = + new Subselect( + selection, + table, + whereExpr, + groupByExprs, + self.havingExpr && havingExpr2, + orderByExprs, + offset, + limit + ) { + override type GroupByF = self.GroupByF + } + + //format: off + def groupBy[F1](expr1: Expr[F1, Source, Any])(implicit verify: GroupByLike[F, F1]): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF with F1] = + new Subselect[F, Repr, Source, Subsource, Head, Tail](selection, table, whereExpr, self.groupByExprs ++ expr1, havingExpr, orderByExprs, offset, limit) { + override type GroupByF = self.GroupByF with F1 + } + + def groupBy[F1, F2](expr1: Expr[F1, Source, Any], expr2: Expr[F2, Source, Any])(implicit verify: GroupByLike[F, F1 with F2]): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF with F1 with F2] = + new Subselect[F, Repr, Source, Subsource, Head, Tail](selection, table, whereExpr, self.groupByExprs ++ expr1 ++ expr2, havingExpr, orderByExprs, offset, limit) { + override type GroupByF = self.GroupByF with F1 with F2 + } + + def groupBy[F1, F2, F3](expr1: Expr[F1, Source, Any], expr2: Expr[F2, Source, Any], expr3: Expr[F3, Source, Any])(implicit verify: GroupByLike[F, F1 with F2 with F3]): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF with F1 with F2 with F3] = + new Subselect[F, Repr, Source, Subsource, Head, Tail](selection, table, whereExpr,self.groupByExprs ++ expr1 ++ expr2 ++ expr3, havingExpr, orderByExprs, offset, limit) { + override type GroupByF = self.GroupByF with F1 with F2 with F3 + } + + def groupBy[F1, F2, F3, F4](expr1: Expr[F1, Source, Any], expr2: Expr[F2, Source, Any], expr3: Expr[F3, Source, Any], expr4: Expr[F4, Source, Any])(implicit verify: GroupByLike[F, F1 with F2 with F3 with F4]): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF with F1 with F2 with F3 with F4] = + new Subselect[F, Repr, Source, Subsource, Head, Tail](selection, table, whereExpr, self.groupByExprs ++ expr1 ++ expr2 ++ expr3 ++ expr4, havingExpr, orderByExprs, offset, limit) { + override type GroupByF = self.GroupByF with F1 with F2 with F3 with F4 + } + + def groupBy[F1, F2, F3, F4, F5](expr1: Expr[F1, Source, Any], expr2: Expr[F2, Source, Any], expr3: Expr[F3, Source, Any], expr4: Expr[F4, Source, Any], expr5: Expr[F5, Source, Any])(implicit verify: GroupByLike[F, F1 with F2 with F3 with F4 with F5]): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF with F1 with F2 with F3 with F4 with F5] = + new Subselect[F, Repr, Source, Subsource, Head, Tail](selection, table, whereExpr, self.groupByExprs ++ expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5, havingExpr, orderByExprs, offset, limit) { + override type GroupByF = self.GroupByF with F1 with F2 with F3 with F4 with F5 + } + + def groupBy[F1, F2, F3, F4, F5, F6](expr1: Expr[F1, Source, Any], expr2: Expr[F2, Source, Any], expr3: Expr[F3, Source, Any], expr4: Expr[F4, Source, Any], expr5: Expr[F5, Source, Any], expr6: Expr[F6, Source, Any])(implicit verify: GroupByLike[F, F1 with F2 with F3 with F4 with F5 with F6]): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF with F1 with F2 with F3 with F4 with F5 with F6] = + new Subselect[F, Repr, Source, Subsource, Head, Tail](selection, table, whereExpr, self.groupByExprs ++ expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6, havingExpr, orderByExprs, offset, limit) { + override type GroupByF = self.GroupByF with F1 with F2 with F3 with F4 with F5 with F6 + } + + //TODO add arities up to 22 if needed + def groupBy[F1, F2, F3, F4, F5, F6, F7](expr1: Expr[F1, Source, Any], expr2: Expr[F2, Source, Any], expr3: Expr[F3, Source, Any], expr4: Expr[F4, Source, Any], expr5: Expr[F5, Source, Any], expr6: Expr[F6, Source, Any], expr7: Expr[F7, Source, Any])(implicit verify: GroupByLike[F, F1 with F2 with F3 with F4 with F5 with F6 with F7]): Subselect.WithGroupByF[F, Repr, Source, Subsource, Head, Tail, self.GroupByF with F1 with F2 with F3 with F4 with F5 with F6 with F7] = + new Subselect[F, Repr, Source, Subsource, Head, Tail](selection, table, whereExpr, self.groupByExprs ++ expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7, havingExpr, orderByExprs, offset, limit) { + override type GroupByF = self.GroupByF with F1 with F2 with F3 with F4 with F5 with F6 with F7 + } + //format: on + + def normalize(implicit + instance: Normalizer[ResultType] + ): Subselect[F, instance.Out, Source, Subsource, Head, Tail] = + self.asInstanceOf[Subselect[F, instance.Out, Source, Subsource, Head, Tail]] + + override def asTable( + name: String + ): Table.DerivedTable[selection.ColumnsOut[Source], Repr, Subselect[ + F, + Repr, + Source, + Subsource, + Head, + Tail + ] { type ColumnsOut = self.ColumnsOut }, Source] = + Table.DerivedTable[self.ColumnsOut, Repr, Subselect[ + F, + Repr, + Source, + Subsource, + Head, + Tail + ] { type ColumnsOut = self.ColumnsOut }, Source](self, name) + + override type ResultType = Repr + + override type TableSource = Source + + override val mapper: Repr => Repr = identity(_) + + override type ColumnsOut = selection.ColumnsOut[Source] + override def columns(name: String) = selection.columns[Source](name) + } + + object Subselect { + + type WithGroupByF[F, Repr, Source, Subsource, Head, Tail <: SelectionSet[Source], GroupByF0] = + Subselect[F, Repr, Source, Subsource, Head, Tail] { + type GroupByF = GroupByF0 + } + + implicit def subselectToExpr[F <: Features.Aggregated[_], Repr, Source, Subsource, Head]( + subselect: Read.Subselect[F, Repr, _ <: Source, Subsource, Head, SelectionSet.Empty] + ): Expr[Features.Derived, Any, Head] = + Expr.Subselect(subselect) + } + + final case class Union[Repr, Out](left: Read.Aux[Repr, Out], right: Read.Aux[Repr, Out], distinct: Boolean) + extends Read[Out] { self => + override type ResultType = Repr + + override val mapper: ResultType => Out = left.mapper + + override type ColumnsOut = left.ColumnsOut + + override type TableSource = left.TableSource + + override def columns(name: String): ColumnsOut = left.columns(name) + + override def asTable(name: String): Table.DerivedTable[left.ColumnsOut, Out, Union[ + Repr, + Out + ] { type ColumnsOut = self.ColumnsOut }, left.TableSource] = + Table + .DerivedTable[self.ColumnsOut, Out, Union[Repr, Out] { type ColumnsOut = self.ColumnsOut }, left.TableSource]( + self, + name + ) + } + + final case class Literal[B: TypeTag](values: Iterable[B]) extends Read[B] { self => + override type ResultType = B + + override val mapper: ResultType => B = identity(_) + + type ColumnIdentity + + def typeTag: TypeTag[B] = implicitly[TypeTag[B]] + + override type ColumnsOut = Expr[Features.Source[ColumnIdentity, Any], Any, B] + override def columns(name: String) = Expr.Source(name, Column.Indexed[B, ColumnIdentity]()) + + override type TableSource = Any + + override def asTable( + name: String + ): Table.DerivedTable[Expr[Features.Source[ColumnIdentity, Any], Any, B], B, Literal[ + B + ] { type ColumnsOut = self.ColumnsOut }, Any] = + Table.DerivedTable[Expr[Features.Source[ColumnIdentity, Any], Any, B], B, Literal[ + B + ] { type ColumnsOut = self.ColumnsOut }, Any](self, name) + } + + implicit def seqToLiteral[B](values: Seq[B])(implicit typeTag: TypeTag[B]): Read[B] = + Read.Literal[B](values) +} diff --git a/core/jvm/src/main/scala/zio/sql/select/SelectAll.scala b/core/jvm/src/main/scala/zio/sql/select/SelectAll.scala new file mode 100644 index 000000000..449fb7aea --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/select/SelectAll.scala @@ -0,0 +1,27 @@ +package zio.sql.select + +import zio.sql.table._ + +final case class SelectAll() { + + //TODO check if helper's types can be moved to table or rewrite to macro + def from[A](table: Table.Source.Aux[A])(implicit helper: SelectAllHelper[table.ColumnsOut, A]): Read.Select[ + helper.F, + helper.ResultTypeRepr, + A, + helper.ColumnHead, + helper.SelectionTail + ] = { + type B0 = SelectionSet.ConsAux[ + helper.ResultTypeRepr, + A, + helper.ColumnHead, + helper.SelectionTail + ] + val b: B0 = ??? //table.all.selection.value.asInstanceOf[B0] + + Read.Subselect[helper.F, helper.ResultTypeRepr, A, A, helper.ColumnHead, helper.SelectionTail]( + Selection[helper.F, A, B0](b), Some(table), true + ) + } +} \ No newline at end of file diff --git a/core/jvm/src/main/scala/zio/sql/select/SelectAllHelper.scala b/core/jvm/src/main/scala/zio/sql/select/SelectAllHelper.scala new file mode 100644 index 000000000..4f363519e --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/select/SelectAllHelper.scala @@ -0,0 +1,944 @@ +package zio.sql.select + +import scala.annotation.implicitNotFound + +import zio.sql.expr.Expr +import zio.sql.select._ + +@implicitNotFound( + "SELECT * currently not supported on joined tables, derived tables and for table of size bigger than 22." +) +sealed trait SelectAllHelper[ColumnsOut, TableType] { + type F + type SelSet <: SelectionSet[TableType] + type ResultTypeRepr + type ColumnHead + type SelectionTail <: SelectionSet[TableType] + + def apply(columns: ColumnsOut): SelectBuilder[F, TableType, SelSet] +} + + // format: off +object SelectAllHelper { + + type Aux[ColumnsOut0, TableType0, F0, SelectionSet0, ResultTypeRepr0, ColumnsHead0, SelectionTail0] = + SelectAllHelper[ColumnsOut0, TableType0] { + type F = F0 + + type SelSet = SelectionSet0 + + type ResultTypeRepr = ResultTypeRepr0 + type ColumnHead = ColumnsHead0 + type SelectionTail = SelectionTail0 + } + + implicit def instance1[F1, TableType, A1]: SelectAllHelper.Aux[Expr[ + F1, + TableType, + A1 + ], TableType, F1, SelectionSet.Cons[TableType, A1, SelectionSet.Empty], A1, A1, SelectionSet.Empty] = + new SelectAllHelper[Expr[F1, TableType, A1], TableType] { + + override type F = F1 + override type SelSet = SelectionSet.Cons[TableType, A1, SelectionSet.Empty] + + override type ResultTypeRepr = A1 + + override type ColumnHead = A1 + override type SelectionTail = SelectionSet.Empty + + override def apply(columns: Expr[F1, TableType, A1]) = + SelectBuilder[F1, TableType, SelectionSet.Cons[TableType, A1, SelectionSet.Empty]](columns) + } + + implicit def instance2[F1, F2, TableType, A1, A2] + : SelectAllHelper.Aux[(Expr[F1, TableType, A1], Expr[F2, TableType, A2]), TableType, F1 with F2, SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Empty] + ], (A1, A2), A1, SelectionSet.Cons[TableType, A2, SelectionSet.Empty]] = + new SelectAllHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2]), TableType] { + + override type F = F1 with F2 + override type SelSet = SelectionSet.Cons[TableType, A1, SelectionSet.Cons[TableType, A2, SelectionSet.Empty]] + + override type ResultTypeRepr = (A1, A2) + + override type ColumnHead = A1 + override type SelectionTail = SelectionSet.Cons[TableType, A2, SelectionSet.Empty] + + override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2])) = { + val selection = columns._1 ++ columns._2 + + SelectBuilder[ + F1 with F2, + TableType, + SelectionSet.Cons[TableType, A1, SelectionSet.Cons[TableType, A2, SelectionSet.Empty]] + ](selection) + } + } + + implicit def instance3[F1, F2, F3, TableType, A1, A2, A3]: SelectAllHelper.Aux[ + (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3]), + TableType, + F1 with F2 with F3, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Empty]] + ], + (A1, A2, A3), + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Empty]] + ] = + new SelectAllHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3]), TableType] { + + override type F = F1 with F2 with F3 + override type SelSet = SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Empty]] + ] + + override type ResultTypeRepr = (A1, A2, A3) + + override type ColumnHead = A1 + override type SelectionTail = + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Empty]] + + override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3])) = { + val selection = columns._1 ++ columns._2 ++ columns._3 + + SelectBuilder[ + F1 with F2 with F3, + TableType, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Empty]] + ] + ](selection) + } + } + + + implicit def instance4[F1, F2, F3, F4, TableType, A1, A2, A3, A4]: SelectAllHelper.Aux[ + (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4]), + TableType, + F1 with F2 with F3 with F4, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Empty]]] + ], + (A1, A2, A3, A4), + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Empty]]] + ] = + new SelectAllHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4]), TableType] { + + override type F = F1 with F2 with F3 with F4 + override type SelSet = SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Empty]]] + ] + + override type ResultTypeRepr = (A1, A2, A3, A4) + + override type ColumnHead = A1 + override type SelectionTail = + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Empty]]] + + override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4])) = { + val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 + + SelectBuilder[ + F1 with F2 with F3 with F4, + TableType, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Empty]]] + ] + ](selection) + } + } + + implicit def instance5[F1, F2, F3, F4, F5, TableType, A1, A2, A3, A4, A5]: SelectAllHelper.Aux[ + (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5]), + TableType, + F1 with F2 with F3 with F4 with F5, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Empty]]]] + ], + (A1, A2, A3, A4, A5), + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Empty]]]] + ] = + new SelectAllHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5]), TableType] { + + override type F = F1 with F2 with F3 with F4 with F5 + override type SelSet = SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Empty]]]] + ] + + override type ResultTypeRepr = (A1, A2, A3, A4, A5) + + override type ColumnHead = A1 + override type SelectionTail = + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Empty]]]] + + override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5])) = { + val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 + + SelectBuilder[ + F1 with F2 with F3 with F4 with F5, + TableType, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Empty]]]] + ] + ](selection) + } + } + + implicit def instance6[F1, F2, F3, F4, F5, F6, TableType, A1, A2, A3, A4, A5, A6]: SelectAllHelper.Aux[ + (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6]), + TableType, + F1 with F2 with F3 with F4 with F5 with F6, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Empty]]]]] + ], + (A1, A2, A3, A4, A5, A6), + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Empty]]]]] + ] = + new SelectAllHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6]), TableType] { + + override type F = F1 with F2 with F3 with F4 with F5 with F6 + override type SelSet = SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Empty]]]]] + ] + + override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6) + + override type ColumnHead = A1 + override type SelectionTail = + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Empty]]]]] + + override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6])) = { + val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 + + SelectBuilder[ + F1 with F2 with F3 with F4 with F5 with F6, + TableType, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Empty]]]]] + ] + ](selection) + } + } + + implicit def instance7[F1, F2, F3, F4, F5, F6, F7, TableType, A1, A2, A3, A4, A5, A6, A7]: SelectAllHelper.Aux[ + (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7]), + TableType, + F1 with F2 with F3 with F4 with F5 with F6 with F7, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Empty]]]]]] + ], + (A1, A2, A3, A4, A5, A6, A7), + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Empty]]]]]] + ] = + new SelectAllHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7]), TableType] { + + override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 + override type SelSet = SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Empty]]]]]] + ] + + override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7) + + override type ColumnHead = A1 + override type SelectionTail = + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Empty]]]]]] + + override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7])) = { + val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 + + SelectBuilder[ + F1 with F2 with F3 with F4 with F5 with F6 with F7, + TableType, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Empty]]]]]] + ] + ](selection) + } + } + + implicit def instance8[F1, F2, F3, F4, F5, F6, F7, F8, TableType, A1, A2, A3, A4, A5, A6, A7, A8]: SelectAllHelper.Aux[ + (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8]), + TableType, + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Empty]]]]]]] + ], + (A1, A2, A3, A4, A5, A6, A7, A8), + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Empty]]]]]]] + ] = + new SelectAllHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8]), TableType] { + + override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 + override type SelSet = SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Empty]]]]]]] + ] + + override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8) + + override type ColumnHead = A1 + override type SelectionTail = + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Empty]]]]]]] + + override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8])) = { + val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 + + SelectBuilder[ + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8, + TableType, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Empty]]]]]]] + ] + ](selection) + } + } + + implicit def instance9[F1, F2, F3, F4, F5, F6, F7, F8, F9, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9]: SelectAllHelper.Aux[ + (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9]), + TableType, + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Empty]]]]]]]] + ], + (A1, A2, A3, A4, A5, A6, A7, A8, A9), + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Empty]]]]]]]] + ] = + new SelectAllHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9]), TableType] { + + override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 + override type SelSet = SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Empty]]]]]]]] + ] + + override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9) + + override type ColumnHead = A1 + override type SelectionTail = + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Empty]]]]]]]] + + override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9])) = { + val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 + + SelectBuilder[ + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9, + TableType, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Empty]]]]]]]] + ] + ](selection) + } + } + + + implicit def instance10[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10]: SelectAllHelper.Aux[ + (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10]), + TableType, + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Empty]]]]]]]]] + ], + (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10), + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Empty]]]]]]]]] + ] = + new SelectAllHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10]), TableType] { + + override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 + override type SelSet = SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Empty]]]]]]]]] + ] + + override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) + + override type ColumnHead = A1 + override type SelectionTail = + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Empty]]]]]]]]] + + override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10])) = { + val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 + + SelectBuilder[ + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10, + TableType, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Empty]]]]]]]]] + ] + ](selection) + } + } + + implicit def instance11[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11]: SelectAllHelper.Aux[ + (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11]), + TableType, + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Empty]]]]]]]]]] + ], + (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11), + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Empty]]]]]]]]]] + ] = + new SelectAllHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11]), TableType] { + + override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 + override type SelSet = SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Empty]]]]]]]]]] + ] + + override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) + + override type ColumnHead = A1 + override type SelectionTail = + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Empty]]]]]]]]]] + + override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11])) = { + val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 + + SelectBuilder[ + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11, + TableType, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Empty]]]]]]]]]] + ] + ](selection) + } + } + + implicit def instance12[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12]: SelectAllHelper.Aux[ + (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12]), + TableType, + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Empty]]]]]]]]]]] + ], + (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12), + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Empty]]]]]]]]]]] + ] = + new SelectAllHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12]), TableType] { + + override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 + override type SelSet = SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Empty]]]]]]]]]]] + ] + + override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12) + + override type ColumnHead = A1 + override type SelectionTail = + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Empty]]]]]]]]]]] + + override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12])) = { + val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 + + SelectBuilder[ + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12, + TableType, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Empty]]]]]]]]]]] + ] + ](selection) + } + } + + implicit def instance13[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13]: SelectAllHelper.Aux[ + (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13]), + TableType, + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Empty]]]]]]]]]]]] + ], + (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13), + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Empty]]]]]]]]]]]] + ] = + new SelectAllHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13]), TableType] { + + override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 + override type SelSet = SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Empty]]]]]]]]]]]] + ] + + override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13) + + override type ColumnHead = A1 + override type SelectionTail = + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Empty]]]]]]]]]]]] + + override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13])) = { + val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 ++ columns._13 + + SelectBuilder[ + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13, + TableType, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Empty]]]]]]]]]]]] + ] + ](selection) + } + } + + implicit def instance14[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14]: SelectAllHelper.Aux[ + (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14]), + TableType, + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Empty]]]]]]]]]]]]] + ], + (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14), + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Empty]]]]]]]]]]]]] + ] = + new SelectAllHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14]), TableType] { + + override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 + override type SelSet = SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Empty]]]]]]]]]]]]] + ] + + override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14) + + override type ColumnHead = A1 + override type SelectionTail = + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Empty]]]]]]]]]]]]] + + override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14])) = { + val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 ++ columns._13 ++ columns._14 + + SelectBuilder[ + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14, + TableType, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Empty]]]]]]]]]]]]] + ] + ](selection) + } + } + + implicit def instance15[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15]: SelectAllHelper.Aux[ + (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15]), + TableType, + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Empty]]]]]]]]]]]]]] + ], + (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15), + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Empty]]]]]]]]]]]]]] + ] = + new SelectAllHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15]), TableType] { + + override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 + override type SelSet = SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Empty]]]]]]]]]]]]]] + ] + + override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15) + + override type ColumnHead = A1 + override type SelectionTail = + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Empty]]]]]]]]]]]]]] + + override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15])) = { + val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 ++ columns._13 ++ columns._14 ++ columns._15 + + SelectBuilder[ + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15, + TableType, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Empty]]]]]]]]]]]]]] + ] + ](selection) + } + } + + implicit def instance16[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16]: SelectAllHelper.Aux[ + (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16]), + TableType, + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Empty]]]]]]]]]]]]]]] + ], + (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16), + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Empty]]]]]]]]]]]]]]] + ] = + new SelectAllHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16]), TableType] { + + override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 + override type SelSet = SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Empty]]]]]]]]]]]]]]] + ] + + override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16) + + override type ColumnHead = A1 + override type SelectionTail = + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Empty]]]]]]]]]]]]]]] + + override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16])) = { + val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 ++ columns._13 ++ columns._14 ++ columns._15 ++ columns._16 + + SelectBuilder[ + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16, + TableType, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Empty]]]]]]]]]]]]]]] + ] + ](selection) + } + } + + implicit def instance17[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17]: SelectAllHelper.Aux[ + (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17]), + TableType, + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Empty]]]]]]]]]]]]]]]] + ], + (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17), + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Empty]]]]]]]]]]]]]]]] + ] = + new SelectAllHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17]), TableType] { + + override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 + override type SelSet = SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Empty]]]]]]]]]]]]]]]] + ] + + override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17) + + override type ColumnHead = A1 + override type SelectionTail = + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Empty]]]]]]]]]]]]]]]] + + override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17])) = { + val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 ++ columns._13 ++ columns._14 ++ columns._15 ++ columns._16 ++ columns._17 + + SelectBuilder[ + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17, + TableType, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Empty]]]]]]]]]]]]]]]] + ] + ](selection) + } + } + + implicit def instance18[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18]: SelectAllHelper.Aux[ + (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18]), + TableType, + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Empty]]]]]]]]]]]]]]]]] + ], + (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18), + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Empty]]]]]]]]]]]]]]]]] + ] = + new SelectAllHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18]), TableType] { + + override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 + override type SelSet = SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Empty]]]]]]]]]]]]]]]]] + ] + + override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18) + + override type ColumnHead = A1 + override type SelectionTail = + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Empty]]]]]]]]]]]]]]]]] + + override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18])) = { + val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 ++ columns._13 ++ columns._14 ++ columns._15 ++ columns._16 ++ columns._17 ++ columns._18 + + SelectBuilder[ + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18, + TableType, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Empty]]]]]]]]]]]]]]]]] + ] + ](selection) + } + } + + implicit def instance19[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19]: SelectAllHelper.Aux[ + (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19]), + TableType, + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Empty]]]]]]]]]]]]]]]]]] + ], + (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19), + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Empty]]]]]]]]]]]]]]]]]] + ] = + new SelectAllHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19]), TableType] { + + override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 + override type SelSet = SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Empty]]]]]]]]]]]]]]]]]] + ] + + override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19) + + override type ColumnHead = A1 + override type SelectionTail = + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Empty]]]]]]]]]]]]]]]]]] + + override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19])) = { + val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 ++ columns._13 ++ columns._14 ++ columns._15 ++ columns._16 ++ columns._17 ++ columns._18 ++ columns._19 + + SelectBuilder[ + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19, + TableType, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Empty]]]]]]]]]]]]]]]]]] + ] + ](selection) + } + } + + implicit def instance20[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20]: SelectAllHelper.Aux[ + (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19], Expr[F20, TableType, A20]), + TableType, + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Empty]]]]]]]]]]]]]]]]]]] + ], + (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20), + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Empty]]]]]]]]]]]]]]]]]]] + ] = + new SelectAllHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19], Expr[F20, TableType, A20]), TableType] { + + override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 + override type SelSet = SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Empty]]]]]]]]]]]]]]]]]]] + ] + + override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20) + + override type ColumnHead = A1 + override type SelectionTail = + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Empty]]]]]]]]]]]]]]]]]]] + + override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19], Expr[F20, TableType, A20])) = { + val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 ++ columns._13 ++ columns._14 ++ columns._15 ++ columns._16 ++ columns._17 ++ columns._18 ++ columns._19 ++ columns._20 + + SelectBuilder[ + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20, + TableType, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Empty]]]]]]]]]]]]]]]]]]] + ] + ](selection) + } + } + + implicit def instance21[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21]: SelectAllHelper.Aux[ + (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19], Expr[F20, TableType, A20], Expr[F21, TableType, A21]), + TableType, + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Cons[TableType, A21, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]] + ], + (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21), + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Cons[TableType, A21, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]] + ] = + new SelectAllHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19], Expr[F20, TableType, A20], Expr[F21, TableType, A21]), TableType] { + + override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21 + override type SelSet = SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Cons[TableType, A21, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]] + ] + + override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21) + + override type ColumnHead = A1 + override type SelectionTail = + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Cons[TableType, A21, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]] + + override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19], Expr[F20, TableType, A20], Expr[F21, TableType, A21])) = { + val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 ++ columns._13 ++ columns._14 ++ columns._15 ++ columns._16 ++ columns._17 ++ columns._18 ++ columns._19 ++ columns._20 ++ columns._21 + + SelectBuilder[ + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21, + TableType, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Cons[TableType, A21, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]] + ] + ](selection) + } + } + + implicit def instance22[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, TableType, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22]: SelectAllHelper.Aux[ + (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19], Expr[F20, TableType, A20], Expr[F21, TableType, A21], Expr[F22, TableType, A22]), + TableType, + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21 with F22, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Cons[TableType, A21, SelectionSet.Cons[TableType, A22, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]] + ], + (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22), + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Cons[TableType, A21, SelectionSet.Cons[TableType, A22, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]] + ] = + new SelectAllHelper[(Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19], Expr[F20, TableType, A20], Expr[F21, TableType, A21], Expr[F22, TableType, A22]), TableType] { + + override type F = F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21 with F22 + override type SelSet = SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10,SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Cons[TableType, A21, SelectionSet.Cons[TableType, A22, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]] + ] + + override type ResultTypeRepr = (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22) + + override type ColumnHead = A1 + override type SelectionTail = + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Cons[TableType, A21, SelectionSet.Cons[TableType, A22, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]] + + override def apply(columns: (Expr[F1, TableType, A1], Expr[F2, TableType, A2], Expr[F3, TableType, A3], Expr[F4, TableType, A4], Expr[F5, TableType, A5], Expr[F6, TableType, A6], Expr[F7, TableType, A7], Expr[F8, TableType, A8], Expr[F9, TableType, A9], Expr[F10, TableType, A10], Expr[F11, TableType, A11], Expr[F12, TableType, A12], Expr[F13, TableType, A13], Expr[F14, TableType, A14], Expr[F15, TableType, A15], Expr[F16, TableType, A16], Expr[F17, TableType, A17], Expr[F18, TableType, A18], Expr[F19, TableType, A19], Expr[F20, TableType, A20], Expr[F21, TableType, A21], Expr[F22, TableType, A22])) = { + val selection = columns._1 ++ columns._2 ++ columns._3 ++ columns._4 ++ columns._5 ++ columns._6 ++ columns._7 ++ columns._8 ++ columns._9 ++ columns._10 ++ columns._11 ++ columns._12 ++ columns._13 ++ columns._14 ++ columns._15 ++ columns._16 ++ columns._17 ++ columns._18 ++ columns._19 ++ columns._20 ++ columns._21 ++ columns._22 + + SelectBuilder[ + F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21 with F22, + TableType, + SelectionSet.Cons[ + TableType, + A1, + SelectionSet.Cons[TableType, A2, SelectionSet.Cons[TableType, A3, SelectionSet.Cons[TableType, A4, SelectionSet.Cons[TableType, A5, SelectionSet.Cons[TableType, A6, SelectionSet.Cons[TableType, A7, SelectionSet.Cons[TableType, A8, SelectionSet.Cons[TableType, A9, SelectionSet.Cons[TableType, A10, SelectionSet.Cons[TableType, A11, SelectionSet.Cons[TableType, A12, SelectionSet.Cons[TableType, A13, SelectionSet.Cons[TableType, A14, SelectionSet.Cons[TableType, A15, SelectionSet.Cons[TableType, A16, SelectionSet.Cons[TableType, A17, SelectionSet.Cons[TableType, A18, SelectionSet.Cons[TableType, A19, SelectionSet.Cons[TableType, A20, SelectionSet.Cons[TableType, A21, SelectionSet.Cons[TableType, A22, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]] + ] + ](selection) + } + } + +} + // format: on diff --git a/core/jvm/src/main/scala/zio/sql/select/SelectBuilder.scala b/core/jvm/src/main/scala/zio/sql/select/SelectBuilder.scala new file mode 100644 index 000000000..5c9cf7d68 --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/select/SelectBuilder.scala @@ -0,0 +1,59 @@ +package zio.sql.select + +import zio.sql.table._ +import zio.sql.macros._ +import scala.language.implicitConversions + +final case class SelectBuilder[F0, Source, B <: SelectionSet[Source]](selection: Selection[F0, Source, B]) { + + def from[Source0 <: Source](table: Table.Aux[Source0])(implicit + ev: B <:< SelectionSet.Cons[Source0, selection.value.ColumnHead, selection.value.SelectionTail], + normalizer: Normalizer[selection.value.ResultTypeRepr] + ): Read.Select[ + F0, + normalizer.Out, + Source0, + selection.value.ColumnHead, + selection.value.SelectionTail + ] = { + type B0 = SelectionSet.ConsAux[ + selection.value.ResultTypeRepr, + Source0, + selection.value.ColumnHead, + selection.value.SelectionTail + ] + val b: B0 = selection.value.asInstanceOf[B0] + + Read.Subselect(Selection[F0, Source0, B0](b), Some(table), true).normalize + } +} + +object SelectBuilder { + + implicit def noTable[F, Source >: Any, B <: SelectionSet[Source]]( + builder: SelectBuilder[F, Source, B] + )(implicit + ev: B <:< SelectionSet.Cons[ + Source, + builder.selection.value.ColumnHead, + builder.selection.value.SelectionTail + ], + normalizer: Normalizer[builder.selection.value.ResultTypeRepr] + ): Read.Select[ + F, + normalizer.Out, + Source, + builder.selection.value.ColumnHead, + builder.selection.value.SelectionTail + ] = { + type B0 = SelectionSet.ConsAux[ + builder.selection.value.ResultTypeRepr, + Source, + builder.selection.value.ColumnHead, + builder.selection.value.SelectionTail + ] + val b: B0 = builder.selection.value.asInstanceOf[B0] + + Read.Subselect(Selection[F, Source, B0](b), None, true).normalize + } +} diff --git a/core/jvm/src/main/scala/zio/sql/select/SelectByCommaBuilder.scala b/core/jvm/src/main/scala/zio/sql/select/SelectByCommaBuilder.scala new file mode 100644 index 000000000..57a81ee95 --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/select/SelectByCommaBuilder.scala @@ -0,0 +1,252 @@ +package zio.sql.select + +import zio.sql.expr.Expr +import zio.sql.select._ + +// format: off + +final case class SelectByCommaBuilder() { + + def apply[F1, Source, B1](expr1: Expr[F1, Source, B1]) = { + SelectBuilder[F1, Source, SelectionSet.Cons[Source, B1, SelectionSet.Empty]](expr1) + } + + def apply[F1, F2, Source, B1, B2](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2]) = { + val selection = expr1 ++ expr2 + SelectBuilder[F1 with F2, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Empty]]](selection) + } + + def apply[F1, F2, F3, Source, B1, B2, B3](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3]) = { + val selection = expr1 ++ expr2 ++ expr3 + SelectBuilder[F1 with F2 with F3, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Empty]]]](selection) + } + + def apply[F1, F2, F3, F4, Source, B1, B2, B3, B4](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 + SelectBuilder[F1 with F2 with F3 with F4, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Empty]]]]](selection) + } + + def apply[F1, F2, F3, F4, F5, Source, B1, B2, B3, B4, B5](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 + SelectBuilder[F1 with F2 with F3 with F4 with F5, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Empty]]]]]](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, Source, B1, B2, B3, B4, B5, B6](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 + SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Empty]]]]]]](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, Source, B1, B2, B3, B4, B5, B6, B7](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 + SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Empty]]]]]]]](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, Source, B1, B2, B3, B4, B5, B6, B7, B8](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 + SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 , Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Empty]]]]]]]]](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 + SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 , Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Empty]]]]]]]]]](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 + SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 , Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Empty]]]]]]]]]]](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 + SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Empty]]]]]]]]]]]](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 + SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Empty]]]]]]]]]]]]](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 + SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Empty]]]]]]]]]]]]]](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 + SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Empty]]]]]]]]]]]]]]](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 + SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Empty]]]]]]]]]]]]]]]](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 + SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Empty]]]]]]]]]]]]]]]]](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 + SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Empty]]]]]]]]]]]]]]]]]](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 + SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Empty]]]]]]]]]]]]]]]]]]](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 + SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19, B20](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19], expr20: Expr[F20, Source, B20]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 ++ expr20 + SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Cons[Source, B20, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19, B20, B21](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19], expr20: Expr[F20, Source, B20], expr21: Expr[F21, Source, B21])= { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 ++ expr20 ++ expr21 + SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Cons[Source, B20, SelectionSet.Cons[Source, B21, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]]](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19, B20, B21, B22](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19], expr20: Expr[F20, Source, B20], expr21: Expr[F21, Source, B21], expr22: Expr[F22, Source, B22]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 ++ expr20 ++ expr21 ++ expr22 + SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21 with F22, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Cons[Source, B20, SelectionSet.Cons[Source, B21, SelectionSet.Cons[Source, B22, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]]]](selection) + } +} + +final class SubselectPartiallyApplied[ParentTable] { + def apply[F, A, B <: SelectionSet[A]](selection: Selection[F, A, B]) = + SubselectBuilder[F, A, B, ParentTable](selection) + + def apply[F1, F2, Source, B1, B2](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2]) = { + val selection = expr1 ++ expr2 + SubselectBuilder[F1 with F2, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Empty]], ParentTable](selection) + } + + def apply[F1, F2, F3, Source, B1, B2, B3](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3]) = { + val selection = expr1 ++ expr2 ++ expr3 + SubselectBuilder[F1 with F2 with F3, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Empty]]], ParentTable](selection) + } + + def apply[F1, F2, F3, F4, Source, B1, B2, B3, B4](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 + SubselectBuilder[F1 with F2 with F3 with F4, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Empty]]]], ParentTable](selection) + } + + def apply[F1, F2, F3, F4, F5, Source, B1, B2, B3, B4, B5](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 + SubselectBuilder[F1 with F2 with F3 with F4 with F5, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Empty]]]]], ParentTable](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, Source, B1, B2, B3, B4, B5, B6](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 + SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Empty]]]]]], ParentTable](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, Source, B1, B2, B3, B4, B5, B6, B7](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 + SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Empty]]]]]]], ParentTable](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, Source, B1, B2, B3, B4, B5, B6, B7, B8](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 + SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Empty]]]]]]]], ParentTable](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9]) = { + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 + SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Empty]]]]]]]]], ParentTable](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 + SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Empty]]]]]]]]]], ParentTable](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 + SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Empty]]]]]]]]]]], ParentTable](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 + SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Empty]]]]]]]]]]]], ParentTable](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 + SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Empty]]]]]]]]]]]]], ParentTable](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 + SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Empty]]]]]]]]]]]]]], ParentTable](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 + SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Empty]]]]]]]]]]]]]]], ParentTable](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 + SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Empty]]]]]]]]]]]]]]]], ParentTable](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 + SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Empty]]]]]]]]]]]]]]]]], ParentTable](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 + SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Empty]]]]]]]]]]]]]]]]]], ParentTable](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 + SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 , Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Empty]]]]]]]]]]]]]]]]]]], ParentTable](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19, B20](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19], expr20: Expr[F20, Source, B20]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 ++ expr20 + SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Cons[Source, B20, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]], ParentTable](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19, B20, B21](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19], expr20: Expr[F20, Source, B20], expr21: Expr[F21, Source, B21]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 ++ expr20 ++ expr21 + SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Cons[Source, B20, SelectionSet.Cons[Source, B21, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]], ParentTable](selection) + } + + def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19, B20, B21, B22](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19], expr20: Expr[F20, Source, B20], expr21: Expr[F21, Source, B21], expr22: Expr[F22, Source, B22]) = { + + val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 ++ expr20 ++ expr21 ++ expr22 + SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21 with F22, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Cons[Source, B20, SelectionSet.Cons[Source, B21, SelectionSet.Cons[Source, B22, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]]], ParentTable](selection) + } +} +// format: on diff --git a/core/jvm/src/main/scala/zio/sql/select/Selection.scala b/core/jvm/src/main/scala/zio/sql/select/Selection.scala new file mode 100644 index 000000000..cc922805f --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/select/Selection.scala @@ -0,0 +1,47 @@ +package zio.sql.select + +import zio.sql.typetag.TypeTag +import zio.sql.expr.Expr + +/** + * A columnar selection of `B` from a source `A`, modeled as `A => B`. + */ +final case class Selection[F, -A, +B <: SelectionSet[A]](value: B) { self => + + type ColsRepr = value.ResultTypeRepr + + type ColumnsOut[S] = value.ColumnsOut[S] + + def columns[S](name: String): ColumnsOut[S] = value.columns[S](name) + + def ++[F2, A1 <: A, C <: SelectionSet[A1]]( + that: Selection[F2, A1, C] + ): Selection[F with F2, A1, self.value.Append[A1, C]] = + Selection(self.value ++ that.value) +} + +object Selection { + import ColumnSelection._ + import SelectionSet.{ Cons, Empty } + + type Aux[F, -A, +B <: SelectionSet[A], ColsRepr0] = Selection[F, A, B] { + type ColsRepr = ColsRepr0 + } + + def constantOption[A: TypeTag](value: A, option: Option[String]): Selection[Any, Any, Cons[Any, A, Empty]] = + Selection(Cons(Constant(value, option), Empty)) + + def constant[A: TypeTag](value: A): Selection[Any, Any, Cons[Any, A, Empty]] = constantOption(value, None) + + def constantAs[A: TypeTag](value: A, name: String): Selection[Any, Any, Cons[Any, A, Empty]] = + constantOption(value, Some(name)) + + def computedOption[F, A, B](expr: Expr[F, A, B], name: Option[String]): Selection[F, A, Cons[A, B, Empty]] = + Selection(Cons(Computed(expr, name), Empty)) + + def computed[F, A, B](expr: Expr[F, A, B]): Selection[F, A, Cons[A, B, Empty]] = + computedOption(expr, None) + + def computedAs[F, A, B](expr: Expr[F, A, B], name: String): Selection[F, A, Cons[A, B, Empty]] = + computedOption(expr, Some(name)) +} diff --git a/core/jvm/src/main/scala/zio/sql/select/SelectionSet.scala b/core/jvm/src/main/scala/zio/sql/select/SelectionSet.scala new file mode 100644 index 000000000..633c7ac9e --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/select/SelectionSet.scala @@ -0,0 +1,99 @@ +package zio.sql.select + +import zio.sql.expr.Expr +import zio.sql.Features +import zio.sql.table.Column + +sealed trait SelectionSet[-Source] { + type SelectionsRepr[Source1, T] + + type ResultTypeRepr + + type Append[Source1, That <: SelectionSet[Source1]] <: SelectionSet[Source1] + + type ColumnHead + + type SelectionTail <: SelectionSet[Source] + type HeadIdentity + + type ColumnsOut[S] + + def columns[S](name: String): ColumnsOut[S] + + def ++[Source1 <: Source, That <: SelectionSet[Source1]](that: That): Append[Source1, That] + + def selectionsUntyped: List[ColumnSelection[Source, _]] + + def selections[Source1 <: Source, T]: SelectionsRepr[Source1, T] +} + +object SelectionSet { + + type Aux[-Source, ResultTypeRepr0] = + SelectionSet[Source] { + type ResultTypeRepr = ResultTypeRepr0 + } + + type ConsAux[ResultTypeRepr0, -Source, A, B <: SelectionSet[Source]] = + SelectionSet.Cons[Source, A, B] { + type ResultTypeRepr = ResultTypeRepr0 + } + + type Empty = Empty.type + + case object Empty extends SelectionSet[Any] { + + override type ColumnHead = Unit + override type SelectionTail = SelectionSet.Empty + + override type HeadIdentity = Any + + override type SelectionsRepr[Source1, T] = Unit + + override type ResultTypeRepr = Unit + + override type Append[Source1, That <: SelectionSet[Source1]] = That + + override type ColumnsOut[S] = Unit + + override def columns[S](name: String): ColumnsOut[S] = () + + override def ++[Source1 <: Any, That <: SelectionSet[Source1]](that: That): Append[Source1, That] = + that + + override def selectionsUntyped: List[ColumnSelection[Any, _]] = Nil + + override def selections[Source1 <: Any, T]: SelectionsRepr[Source1, T] = () + } + + final case class Cons[-Source, A, B <: SelectionSet[Source]](head: ColumnSelection[Source, A], tail: B) + extends SelectionSet[Source] { self => + + override type ColumnHead = A + override type SelectionTail = B + + override type HeadIdentity = head.toColumn.Identity + + override type SelectionsRepr[Source1, T] = (ColumnSelection[Source1, A], tail.SelectionsRepr[Source1, T]) + + override type ResultTypeRepr = (A, tail.ResultTypeRepr) + + override type Append[Source1, That <: SelectionSet[Source1]] = + Cons[Source1, A, tail.Append[Source1, That]] + + override type ColumnsOut[S] = (Expr[Features.Source[HeadIdentity, S], S, A], tail.ColumnsOut[S]) + + override def columns[S](name: String): ColumnsOut[S] = { + val column: Column.Aux[A, HeadIdentity] = head.toColumn + + (Expr.Source(name, column), tail.columns[S](name)) + } + + override def ++[Source1 <: Source, That <: SelectionSet[Source1]](that: That): Append[Source1, That] = + Cons[Source1, A, tail.Append[Source1, That]](head, tail ++ that) + + override def selectionsUntyped: List[ColumnSelection[Source, _]] = head :: tail.selectionsUntyped + + override def selections[Source1 <: Source, T]: SelectionsRepr[Source1, T] = (head, tail.selections[Source1, T]) + } +} diff --git a/core/jvm/src/main/scala/zio/sql/select/SubselectBuilder.scala b/core/jvm/src/main/scala/zio/sql/select/SubselectBuilder.scala new file mode 100644 index 000000000..10b513c37 --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/select/SubselectBuilder.scala @@ -0,0 +1,31 @@ +package zio.sql.select + +import zio.sql.table._ +import zio.sql.macros._ + +final case class SubselectBuilder[F, Source, B <: SelectionSet[Source], ParentTable]( + selection: Selection[F, Source, B] +) { + def from[Source0](table: Table.Aux[Source0])(implicit + ev1: Source0 with ParentTable <:< Source, + ev2: B <:< SelectionSet.Cons[Source, selection.value.ColumnHead, selection.value.SelectionTail], + normalizer: Normalizer[selection.value.ResultTypeRepr] + ): Read.Subselect[ + F, + normalizer.Out, + Source with ParentTable, + Source0, + selection.value.ColumnHead, + selection.value.SelectionTail + ] = { + type B0 = SelectionSet.ConsAux[ + selection.value.ResultTypeRepr, + Source with ParentTable, + selection.value.ColumnHead, + selection.value.SelectionTail + ] + val b: B0 = selection.value.asInstanceOf[B0] + + Read.Subselect(Selection[F, Source with ParentTable, B0](b), Some(table), true).normalize + } +} \ No newline at end of file diff --git a/core/jvm/src/main/scala/zio/sql/selectutils.scala b/core/jvm/src/main/scala/zio/sql/selectutils.scala deleted file mode 100644 index 71e0aa681..000000000 --- a/core/jvm/src/main/scala/zio/sql/selectutils.scala +++ /dev/null @@ -1,274 +0,0 @@ -package zio.sql - -// format: off -trait SelectUtilsModule { self: TableModule with ExprModule with InsertModule with SelectModule with AllColumnsModule => - - sealed case class SelectAll() { - - def from[A](table: Table.Source.Aux[A])(implicit helper: ColumnsHelper[table.ColumnsOut, A]): Read.Select[ - helper.F, - helper.ResultTypeRepr, - A, - helper.ColumnHead, - helper.SelectionTail - ] = { - type B0 = SelectionSet.ConsAux[ - helper.ResultTypeRepr, - A, - helper.ColumnHead, - helper.SelectionTail - ] - val b: B0 = table.all.selection.value.asInstanceOf[B0] - - Read.Subselect[helper.F, helper.ResultTypeRepr, A, A, helper.ColumnHead, helper.SelectionTail]( - Selection[helper.F, A, B0](b), Some(table), true - ) - } - } - - sealed case class SelectByCommaBuilder() { - - def apply[F1, Source, B1](expr1: Expr[F1, Source, B1]) = { - SelectBuilder[F1, Source, SelectionSet.Cons[Source, B1, SelectionSet.Empty]](expr1) - } - - def apply[F1, F2, Source, B1, B2](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2]) = { - val selection = expr1 ++ expr2 - SelectBuilder[F1 with F2, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Empty]]](selection) - } - - def apply[F1, F2, F3, Source, B1, B2, B3](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3]) = { - val selection = expr1 ++ expr2 ++ expr3 - SelectBuilder[F1 with F2 with F3, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Empty]]]](selection) - } - - def apply[F1, F2, F3, F4, Source, B1, B2, B3, B4](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 - SelectBuilder[F1 with F2 with F3 with F4, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Empty]]]]](selection) - } - - def apply[F1, F2, F3, F4, F5, Source, B1, B2, B3, B4, B5](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 - SelectBuilder[F1 with F2 with F3 with F4 with F5, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Empty]]]]]](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, Source, B1, B2, B3, B4, B5, B6](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 - SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Empty]]]]]]](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, Source, B1, B2, B3, B4, B5, B6, B7](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 - SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Empty]]]]]]]](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, Source, B1, B2, B3, B4, B5, B6, B7, B8](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 - SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 , Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Empty]]]]]]]]](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 - SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 , Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Empty]]]]]]]]]](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 - SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 , Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Empty]]]]]]]]]]](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 - SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Empty]]]]]]]]]]]](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 - SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Empty]]]]]]]]]]]]](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 - SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Empty]]]]]]]]]]]]]](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 - SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Empty]]]]]]]]]]]]]]](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 - SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Empty]]]]]]]]]]]]]]]](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 - SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Empty]]]]]]]]]]]]]]]]](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 - SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Empty]]]]]]]]]]]]]]]]]](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 - SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Empty]]]]]]]]]]]]]]]]]]](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 - SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19, B20](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19], expr20: Expr[F20, Source, B20]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 ++ expr20 - SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Cons[Source, B20, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19, B20, B21](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19], expr20: Expr[F20, Source, B20], expr21: Expr[F21, Source, B21])= { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 ++ expr20 ++ expr21 - SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Cons[Source, B20, SelectionSet.Cons[Source, B21, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]]](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19, B20, B21, B22](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19], expr20: Expr[F20, Source, B20], expr21: Expr[F21, Source, B21], expr22: Expr[F22, Source, B22]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 ++ expr20 ++ expr21 ++ expr22 - SelectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21 with F22, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Cons[Source, B20, SelectionSet.Cons[Source, B21, SelectionSet.Cons[Source, B22, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]]]](selection) - } - } - - final class SubselectPartiallyApplied[ParentTable] { - def apply[F, A, B <: SelectionSet[A]](selection: Selection[F, A, B]) = - SubselectBuilder[F, A, B, ParentTable](selection) - - def apply[F1, F2, Source, B1, B2](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2]) = { - val selection = expr1 ++ expr2 - SubselectBuilder[F1 with F2, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Empty]], ParentTable](selection) - } - - def apply[F1, F2, F3, Source, B1, B2, B3](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3]) = { - val selection = expr1 ++ expr2 ++ expr3 - SubselectBuilder[F1 with F2 with F3, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Empty]]], ParentTable](selection) - } - - def apply[F1, F2, F3, F4, Source, B1, B2, B3, B4](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 - SubselectBuilder[F1 with F2 with F3 with F4, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Empty]]]], ParentTable](selection) - } - - def apply[F1, F2, F3, F4, F5, Source, B1, B2, B3, B4, B5](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 - SubselectBuilder[F1 with F2 with F3 with F4 with F5, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Empty]]]]], ParentTable](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, Source, B1, B2, B3, B4, B5, B6](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 - SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Empty]]]]]], ParentTable](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, Source, B1, B2, B3, B4, B5, B6, B7](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 - SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Empty]]]]]]], ParentTable](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, Source, B1, B2, B3, B4, B5, B6, B7, B8](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 - SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Empty]]]]]]]], ParentTable](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9]) = { - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 - SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Empty]]]]]]]]], ParentTable](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 - SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Empty]]]]]]]]]], ParentTable](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 - SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Empty]]]]]]]]]]], ParentTable](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 - SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Empty]]]]]]]]]]]], ParentTable](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 - SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Empty]]]]]]]]]]]]], ParentTable](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 - SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Empty]]]]]]]]]]]]]], ParentTable](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 - SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Empty]]]]]]]]]]]]]]], ParentTable](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 - SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Empty]]]]]]]]]]]]]]]], ParentTable](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 - SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Empty]]]]]]]]]]]]]]]]], ParentTable](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 - SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Empty]]]]]]]]]]]]]]]]]], ParentTable](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 - SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 , Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Empty]]]]]]]]]]]]]]]]]]], ParentTable](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19, B20](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19], expr20: Expr[F20, Source, B20]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 ++ expr20 - SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Cons[Source, B20, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]], ParentTable](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19, B20, B21](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19], expr20: Expr[F20, Source, B20], expr21: Expr[F21, Source, B21]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 ++ expr20 ++ expr21 - SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Cons[Source, B20, SelectionSet.Cons[Source, B21, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]], ParentTable](selection) - } - - def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, Source, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19, B20, B21, B22](expr1: Expr[F1, Source, B1], expr2: Expr[F2, Source, B2], expr3: Expr[F3, Source, B3], expr4: Expr[F4, Source, B4], expr5: Expr[F5, Source, B5], expr6: Expr[F6, Source, B6], expr7: Expr[F7, Source, B7], expr8: Expr[F8, Source, B8], expr9: Expr[F9, Source, B9], expr10: Expr[F10, Source, B10], expr11: Expr[F11, Source, B11], expr12: Expr[F12, Source, B12], expr13: Expr[F13, Source, B13], expr14: Expr[F14, Source, B14], expr15: Expr[F15, Source, B15], expr16: Expr[F16, Source, B16], expr17: Expr[F17, Source, B17], expr18: Expr[F18, Source, B18], expr19: Expr[F19, Source, B19], expr20: Expr[F20, Source, B20], expr21: Expr[F21, Source, B21], expr22: Expr[F22, Source, B22]) = { - - val selection = expr1 ++ expr2 ++ expr3 ++ expr4 ++ expr5 ++ expr6 ++ expr7 ++ expr8 ++ expr9 ++ expr10 ++ expr11 ++ expr12 ++ expr13 ++ expr14 ++ expr15 ++ expr16 ++ expr17 ++ expr18 ++ expr19 ++ expr20 ++ expr21 ++ expr22 - SubselectBuilder[F1 with F2 with F3 with F4 with F5 with F6 with F7 with F8 with F9 with F10 with F11 with F12 with F13 with F14 with F15 with F16 with F17 with F18 with F19 with F20 with F21 with F22, Source, SelectionSet.Cons[Source, B1, SelectionSet.Cons[Source, B2, SelectionSet.Cons[Source, B3, SelectionSet.Cons[Source, B4, SelectionSet.Cons[Source, B5, SelectionSet.Cons[Source, B6, SelectionSet.Cons[Source, B7, SelectionSet.Cons[Source, B8, SelectionSet.Cons[Source, B9, SelectionSet.Cons[Source, B10, SelectionSet.Cons[Source, B11, SelectionSet.Cons[Source, B12, SelectionSet.Cons[Source, B13, SelectionSet.Cons[Source, B14, SelectionSet.Cons[Source, B15, SelectionSet.Cons[Source, B16, SelectionSet.Cons[Source, B17, SelectionSet.Cons[Source, B18, SelectionSet.Cons[Source, B19, SelectionSet.Cons[Source, B20, SelectionSet.Cons[Source, B21, SelectionSet.Cons[Source, B22, SelectionSet.Empty]]]]]]]]]]]]]]]]]]]]]], ParentTable](selection) - } - } -} -// format: on diff --git a/core/jvm/src/main/scala/zio/sql/table.scala b/core/jvm/src/main/scala/zio/sql/table.scala deleted file mode 100644 index 11775ca02..000000000 --- a/core/jvm/src/main/scala/zio/sql/table.scala +++ /dev/null @@ -1,345 +0,0 @@ -package zio.sql - -import zio.schema._ -import zio.sql.macros.TableSchema -import scala.annotation.StaticAnnotation -import scala.collection.immutable -import zio.sql.macros.IsNotLiteral - -object TableAnnotation { - case class name(name: String) extends StaticAnnotation -} - -trait TableModule { self: ExprModule with SelectModule with UtilsModule with SelectUtilsModule with AllColumnsModule => - - type Lens[F, S, A] = Expr[Features.Source[F, S], S, A] - - type Prism[F, S, A] = Unit - - type Traversal[S, A] = Unit - - /** - * Creates a table descripton from the Schema of T. - * Table name is taken either from @name annotation or schema id type and pluralized. - */ - // TODO do not allow CaseClass0 with macro - def defineTableSmart[T](implicit - schema: Schema.Record[T], - tableLike: TableSchema[T] - ): Table.Source.WithTableDetails[schema.Terms, T, schema.Accessors[Lens, Prism, Traversal]] = { - val tableName = extractAnnotationName(schema) match { - case Some(name) => name - case None => - pluralize( - convertToSnakeCase(schema.id.name) - .split("_") - .toList - ) - } - - defineTable(tableName) - } - - /** - * Creates a table descripton from the Schema of T. - * Table name is taken either from @name annotation or schema id type. - */ - def defineTable[T](implicit - schema: Schema.Record[T], - tableLike: TableSchema[T] - ): Table.Source.WithTableDetails[schema.Terms, T, schema.Accessors[Lens, Prism, Traversal]] = { - val tableName = extractAnnotationName(schema) match { - case Some(name) => name - case None => convertToSnakeCase(schema.id.name) - } - - defineTable(tableName) - } - - /** - * Creates a table descripton from the Schema of T. - * Table name is explicitely provided. - */ - def defineTable[T]( - tableName: String - )(implicit - schema: Schema.Record[T], - tableLike: TableSchema[T] - ): Table.Source.WithTableDetails[schema.Terms, T, schema.Accessors[Lens, Prism, Traversal]] = - new Table.Source { - - protected[sql] val exprAccessorBuilder = new ExprAccessorBuilder(tableName) - - override protected[sql] type AllColumnIdentities = schema.Terms - - override protected[sql] type TableType = T - - override protected[sql] type ColumnsOut = - schema.Accessors[exprAccessorBuilder.Lens, exprAccessorBuilder.Prism, exprAccessorBuilder.Traversal] - - override val columns: ColumnsOut = schema.makeAccessors(exprAccessorBuilder) - - override protected[sql] def all(implicit - helper: ColumnsHelper[ColumnsOut, TableType] - ): SelectBuilder[helper.F, TableType, helper.SelSet] = - helper.apply(columns) - - override val name: TableName = tableName.toLowerCase() - } - - private def convertToSnakeCase(name: String): String = { - val temp = (name.head.toLower.toString + name.tail) - temp.indexWhere(_.isUpper) match { - case -1 => temp - case i => - val (prefix, suffix) = temp.splitAt(i) - prefix + "_" + convertToSnakeCase(suffix) - } - } - - private def pluralize(names: List[String]): String = - names match { - case Nil => "" - case head :: immutable.Nil => Pluralize.pluralize(head) - case head :: next => head + "_" + pluralize(next) - } - - private def extractAnnotationName[T](schema: Schema.Record[T]): Option[String] = - schema.annotations.collectFirst { case TableAnnotation.name(name) => name } match { - case Some(name) if raw"[A-Za-z_][A-Za-z0-9_]*".r.pattern.matcher(name).matches() => Some(name) - case _ => None - } - - class ExprAccessorBuilder(name: TableName) extends AccessorBuilder { - - override type Lens[F, S, A] = Expr[Features.Source[F, S], S, A] - - override type Prism[F, S, A] = Unit - - override type Traversal[S, A] = Unit - - def makeLens[F, S, A](product: Schema.Record[S], term: Schema.Field[S, A]): Expr[Features.Source[F, S], S, A] = { - implicit val typeTag = deriveTypeTag(term.schema).get - - val column: Column.Aux[A, F] = Column.Named[A, F](convertToSnakeCase(term.name.toString())) - - Expr.Source(name, column) - } - - def makePrism[F, S, A](sum: Schema.Enum[S], term: Schema.Case[S, A]): Unit = () - - def makeTraversal[S, A](collection: Schema.Collection[S, A], element: Schema[A]): Traversal[S, A] = () - - } - - sealed trait Column[+A] { - type Identity - def typeTag: TypeTag[A] - - def name: Option[String] - - def nullable[A1 >: A](implicit ev: TypeTag.NotNull[A1]): Column.Aux[Option[A1], Identity] - } - - object Column { - - type Aux[+A0, Identity0] = Column[A0] { - type Identity = Identity0 - } - - sealed case class Named[A: TypeTag, ColumnIdentity](columnName: String) extends Column[A] { - override type Identity = ColumnIdentity - - override def typeTag: TypeTag[A] = implicitly[TypeTag[A]] - - override def name = Some(columnName) - - override def nullable[A1 >: A](implicit ev: TypeTag.NotNull[A1]): Column.Aux[Option[A1], Identity] = - Column.Named[Option[A1], ColumnIdentity](columnName) - } - - sealed case class Indexed[A: TypeTag, ColumnIdentity]() extends Column[A] { - - override type Identity = ColumnIdentity - - override def typeTag: TypeTag[A] = implicitly[TypeTag[A]] - - override def name = None - - override def nullable[A1 >: A](implicit ev: TypeTag.NotNull[A1]): Column.Aux[Option[A1], Identity] = - Column.Indexed[Option[A1], ColumnIdentity]() - } - - type Untyped = Column[_] - } - - sealed trait JoinType - - object JoinType { - case object Inner extends JoinType - case object LeftOuter extends JoinType - case object RightOuter extends JoinType - case object FullOuter extends JoinType - } - - sealed trait Table { self => - protected[sql] type TableType - - final def fullOuter[That](that: Table.Aux[That]): Table.JoinBuilder[self.TableType, That] = - new Table.JoinBuilder[self.TableType, That](JoinType.FullOuter, self, that) - - final def join[That](that: Table.Aux[That]): Table.JoinBuilder[self.TableType, That] = - new Table.JoinBuilder[self.TableType, That](JoinType.Inner, self, that) - - final def leftOuter[That](that: Table.Aux[That]): Table.JoinBuilder[self.TableType, That] = - new Table.JoinBuilder[self.TableType, That](JoinType.LeftOuter, self, that) - - final def rightOuter[That](that: Table.Aux[That]): Table.JoinBuilder[self.TableType, That] = - new Table.JoinBuilder[self.TableType, That](JoinType.RightOuter, self, that) - - final val subselect: SubselectPartiallyApplied[TableType] = new SubselectPartiallyApplied[TableType] - } - - object Table { - - class JoinBuilder[A, B](joinType: JoinType, left: Table.Aux[A], right: Table.Aux[B]) { - def on[F](expr: Expr[F, A with B, Boolean])(implicit ev: IsNotLiteral[F]): Table.Aux[A with B] = - Joined(joinType, left, right, expr) - } - - type Aux[A] = Table { type TableType = A } - - type WithColumnsOut[A, ColumnsOut0] = Table { - type TabelType = A - type ColumnsOut = ColumnsOut0 - } - - trait Insanity { - protected[sql] def ahhhhhhhhhhhhh[A]: A - } - - sealed trait Source extends Table with Insanity { - protected[sql] type AllColumnIdentities - - val name: TableName - - protected[sql] type ColumnsOut - - val columns: ColumnsOut - - protected[sql] def all(implicit - helper: ColumnsHelper[ColumnsOut, TableType] - ): SelectBuilder[helper.F, TableType, helper.SelSet] - - override protected[sql] def ahhhhhhhhhhhhh[A]: A = ??? // don't remove or it'll break - } - - object Source { - type Aux[A] = Table.Source { - type TableType = A - } - - type Aux_[A, AllColumnIdentities0] = Table.Source { - type TableType = A - type AllColumnIdentities = AllColumnIdentities0 - } - - type WithTableDetails[AllColumnIdentities0, T, ColumnsOut0] = Table.Source { - type AllColumnIdentities = AllColumnIdentities0 - type TableType = T - type ColumnsOut = ColumnsOut0 - } - } - - sealed case class Joined[FF, A, B]( - joinType: JoinType, - left: Table.Aux[A], - right: Table.Aux[B], - on: Expr[FF, A with B, Boolean] - ) extends Table { - - override type TableType = left.TableType with right.TableType - } - - sealed case class DerivedTable[CO, +Out, +R <: Read.WithReprs[Out, CO], Source](read: R, name: TableName) - extends Table { - self => - type ColumnsOut = CO - - override type TableType = Source - - def columns(implicit normalizer: TrailingUnitNormalizer[CO]): normalizer.Out = - normalizer.apply(read.columns(name)) - } - - sealed case class DialectSpecificTable[A](tableExtension: TableExtension[A]) extends Table { - - override type TableType = A - } - - trait TableEx[A] - } - - type TableExtension[A] <: Table.TableEx[A] - - def deriveTypeTag[A](standardType: StandardType[A]): Option[TypeTag.NotNull[A]] = - standardType match { - case StandardType.BigDecimalType => Some(TypeTag.TBigDecimal) - case StandardType.BoolType => Some(TypeTag.TBoolean) - case StandardType.ByteType => Some(TypeTag.TByte) - case StandardType.BinaryType => Some(TypeTag.TByteArray) - case StandardType.CharType => Some(TypeTag.TChar) - case StandardType.DoubleType => Some(TypeTag.TDouble) - case StandardType.FloatType => Some(TypeTag.TFloat) - case StandardType.InstantType => Some(TypeTag.TInstant) - case StandardType.IntType => Some(TypeTag.TInt) - case StandardType.LocalDateType => Some(TypeTag.TLocalDate) - case StandardType.LocalDateTimeType => Some(TypeTag.TLocalDateTime) - case StandardType.OffsetTimeType => Some(TypeTag.TOffsetTime) - case StandardType.LocalTimeType => Some(TypeTag.TLocalTime) - case StandardType.LongType => Some(TypeTag.TLong) - case StandardType.OffsetDateTimeType => Some(TypeTag.TOffsetDateTime) - case StandardType.ShortType => Some(TypeTag.TShort) - case StandardType.StringType => Some(TypeTag.TString) - case StandardType.UUIDType => Some(TypeTag.TUUID) - case StandardType.ZonedDateTimeType => Some(TypeTag.TZonedDateTime) - // TODO What other types to support ? - case StandardType.BigIntegerType => None - case StandardType.ZoneOffsetType => None - case StandardType.DurationType => None - case StandardType.YearType => None - case StandardType.MonthType => None - case StandardType.MonthDayType => None - case StandardType.ZoneIdType => None - case StandardType.PeriodType => None - case StandardType.YearMonthType => None - case StandardType.DayOfWeekType => None - case StandardType.UnitType => None - } - - def deriveTypeTag[A](opSchema: Schema.Optional[A]): Option[TypeTag[Option[A]]] = - opSchema.schema match { - case Schema.Primitive(standardType, _) => - implicit val notNullTypeTag = deriveTypeTag(standardType).get - - Some(TypeTag.option[A]) - case _ => None - } - - def deriveTypeTag[A](fieldSchema: Schema[A]): Option[TypeTag[A]] = - fieldSchema match { - case s: Schema.Optional[_] => deriveTypeTag(s) - case s: Schema.Lazy[A] => deriveTypeTag(s.schema) - case Schema.Primitive(standardType, _) => deriveTypeTag(standardType) - case Schema.Sequence(elementSchema, _, _, _, _) => - elementSchema match { - case Schema.Primitive(standardType, _) if (standardType == StandardType.ByteType) => - Some(TypeTag.TByteArray.asInstanceOf[TypeTag[A]]) - case _ => None - } - - // TODO get TypeTag of A available out of Schema[A] and derive typetag from Schema.Transform - case _: Schema.Transform[_, _, _] => None - case _ => None - } -} diff --git a/core/jvm/src/main/scala/zio/sql/table/Column.scala b/core/jvm/src/main/scala/zio/sql/table/Column.scala new file mode 100644 index 000000000..a1c2744e9 --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/table/Column.scala @@ -0,0 +1,44 @@ +package zio.sql.table + +import zio.sql.typetag.TypeTag + +sealed trait Column[+A] { + type Identity + def typeTag: TypeTag[A] + + def name: Option[String] + + def nullable[A1 >: A](implicit ev: TypeTag.NotNull[A1]): Column.Aux[Option[A1], Identity] +} + +object Column { + + type Aux[+A0, Identity0] = Column[A0] { + type Identity = Identity0 + } + + final case class Named[A: TypeTag, ColumnIdentity](columnName: String) extends Column[A] { + override type Identity = ColumnIdentity + + override def typeTag: TypeTag[A] = implicitly[TypeTag[A]] + + override def name = Some(columnName) + + override def nullable[A1 >: A](implicit ev: TypeTag.NotNull[A1]): Column.Aux[Option[A1], Identity] = + Column.Named[Option[A1], ColumnIdentity](columnName) + } + + final case class Indexed[A: TypeTag, ColumnIdentity]() extends Column[A] { + + override type Identity = ColumnIdentity + + override def typeTag: TypeTag[A] = implicitly[TypeTag[A]] + + override def name = None + + override def nullable[A1 >: A](implicit ev: TypeTag.NotNull[A1]): Column.Aux[Option[A1], Identity] = + Column.Indexed[Option[A1], ColumnIdentity]() + } + + type Untyped = Column[_] +} diff --git a/core/jvm/src/main/scala/zio/sql/table/ExprAccesorBuilder.scala b/core/jvm/src/main/scala/zio/sql/table/ExprAccesorBuilder.scala new file mode 100644 index 000000000..c9456b8d1 --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/table/ExprAccesorBuilder.scala @@ -0,0 +1,29 @@ +package zio.sql.table + +import zio.sql._ +import zio.schema._ +import zio.sql.typetag._ + +import zio.sql.expr.Expr + +class ExprAccessorBuilder(name: String) extends AccessorBuilder { + + override type Lens[F, S, A] = Expr[Features.Source[F, S], S, A] + + override type Prism[F, S, A] = Unit + + override type Traversal[S, A] = Unit + + def makeLens[F, S, A](product: Schema.Record[S], term: Schema.Field[S, A]): Expr[Features.Source[F, S], S, A] = { + implicit val typeTag = TypeTag.deriveTypeTag(term.schema).get + + val column: Column.Aux[A, F] = Column.Named[A, F](Table.convertToSnakeCase(term.name.toString())) + + Expr.Source(name, column) + } + + def makePrism[F, S, A](sum: Schema.Enum[S], term: Schema.Case[S, A]): Unit = () + + def makeTraversal[S, A](collection: Schema.Collection[S, A], element: Schema[A]): Traversal[S, A] = () + +} \ No newline at end of file diff --git a/core/jvm/src/main/scala/zio/sql/table/JoinType.scala b/core/jvm/src/main/scala/zio/sql/table/JoinType.scala new file mode 100644 index 000000000..dcd830f4d --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/table/JoinType.scala @@ -0,0 +1,10 @@ +package zio.sql.table + +sealed trait JoinType + +object JoinType { + case object Inner extends JoinType + case object LeftOuter extends JoinType + case object RightOuter extends JoinType + case object FullOuter extends JoinType +} diff --git a/core/jvm/src/main/scala/zio/sql/table/Table.scala b/core/jvm/src/main/scala/zio/sql/table/Table.scala new file mode 100644 index 000000000..778f40b14 --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/table/Table.scala @@ -0,0 +1,199 @@ +package zio.sql.table + +import zio.schema._ +import zio.sql.macros.TableSchema +import scala.collection.immutable +import zio.sql.macros.IsNotLiteral +import zio.sql._ +import zio.sql.utils.TrailingUnitNormalizer + +import zio.sql.expr.Expr +import zio.sql.select._ + +import zio.sql.utils.Pluralize + +sealed trait Table { self => + protected[sql] type TableType + + final def fullOuter[That](that: Table.Aux[That]): Table.JoinBuilder[self.TableType, That] = + new Table.JoinBuilder[self.TableType, That](JoinType.FullOuter, self, that) + + final def join[That](that: Table.Aux[That]): Table.JoinBuilder[self.TableType, That] = + new Table.JoinBuilder[self.TableType, That](JoinType.Inner, self, that) + + final def leftOuter[That](that: Table.Aux[That]): Table.JoinBuilder[self.TableType, That] = + new Table.JoinBuilder[self.TableType, That](JoinType.LeftOuter, self, that) + + final def rightOuter[That](that: Table.Aux[That]): Table.JoinBuilder[self.TableType, That] = + new Table.JoinBuilder[self.TableType, That](JoinType.RightOuter, self, that) + + final val subselect: SubselectPartiallyApplied[TableType] = new SubselectPartiallyApplied[TableType] +} + +object Table { + + /** + * Creates a table descripton from the Schema of T. + * Table name is taken either from @name annotation or schema id type and pluralized. + */ + // TODO do not allow CaseClass0 with macro + def defineTableSmart[T](implicit + schema: Schema.Record[T], + tableLike: TableSchema[T] + ): Table.Source.WithTableDetails[schema.Terms, T, schema.Accessors[Lens, Prism, Traversal]] = { + val tableName = extractAnnotationName(schema) match { + case Some(name) => name + case None => + pluralize( + convertToSnakeCase(schema.id.name) + .split("_") + .toList + ) + } + + defineTable(tableName) + } + + /** + * Creates a table descripton from the Schema of T. + * Table name is taken either from @name annotation or schema id type. + */ + def defineTable[T](implicit + schema: Schema.Record[T], + tableLike: TableSchema[T] + ): Table.Source.WithTableDetails[schema.Terms, T, schema.Accessors[Lens, Prism, Traversal]] = { + val tableName = extractAnnotationName(schema) match { + case Some(name) => name + case None => convertToSnakeCase(schema.id.name) + } + + defineTable(tableName) + } + + /** + * Creates a table descripton from the Schema of T. + * Table name is explicitely provided. + */ + def defineTable[T]( + tableName: String + )(implicit + schema: Schema.Record[T], + tableLike: TableSchema[T] + ): Table.Source.WithTableDetails[schema.Terms, T, schema.Accessors[Lens, Prism, Traversal]] = + new Table.Source { + + protected[sql] val exprAccessorBuilder = new ExprAccessorBuilder(tableName) + + override protected[sql] type AllColumnIdentities = schema.Terms + + override protected[sql] type TableType = T + + override protected[sql] type ColumnsOut = + schema.Accessors[exprAccessorBuilder.Lens, exprAccessorBuilder.Prism, exprAccessorBuilder.Traversal] + + override val columns: ColumnsOut = schema.makeAccessors(exprAccessorBuilder) + + override protected[sql] def all(implicit + helper: SelectAllHelper[ColumnsOut, TableType] + ): SelectBuilder[helper.F, TableType, helper.SelSet] = + helper.apply(columns) + + override val name: String = tableName.toLowerCase() + } + + def convertToSnakeCase(name: String): String = { + val temp = (name.head.toLower.toString + name.tail) + temp.indexWhere(_.isUpper) match { + case -1 => temp + case i => + val (prefix, suffix) = temp.splitAt(i) + prefix + "_" + convertToSnakeCase(suffix) + } + } + + private def pluralize(names: List[String]): String = + names match { + case Nil => "" + case head :: immutable.Nil => Pluralize.pluralize(head) + case head :: next => head + "_" + pluralize(next) + } + + private def extractAnnotationName[T](schema: Schema.Record[T]): Option[String] = + schema.annotations.collectFirst { case TableNameAnnotation.name(name) => name } match { + case Some(name) if raw"[A-Za-z_][A-Za-z0-9_]*".r.pattern.matcher(name).matches() => Some(name) + case _ => None + } + + class JoinBuilder[A, B](joinType: JoinType, left: Table.Aux[A], right: Table.Aux[B]) { + def on[F](expr: Expr[F, A with B, Boolean])(implicit ev: IsNotLiteral[F]): Table.Aux[A with B] = + Joined(joinType, left, right, expr) + } + + type Aux[A] = Table { type TableType = A } + + type WithColumnsOut[A, ColumnsOut0] = Table { + type TabelType = A + type ColumnsOut = ColumnsOut0 + } + + sealed trait Source extends Table { + protected[sql] type AllColumnIdentities + + val name: String + + protected[sql] type ColumnsOut + + val columns: ColumnsOut + + protected[sql] def all(implicit + helper: SelectAllHelper[ColumnsOut, TableType] + ): SelectBuilder[helper.F, TableType, helper.SelSet] + } + + object Source { + type Aux[A] = Table.Source { + type TableType = A + } + + type Aux_[A, AllColumnIdentities0] = Table.Source { + type TableType = A + type AllColumnIdentities = AllColumnIdentities0 + } + + type WithTableDetails[AllColumnIdentities0, T, ColumnsOut0] = Table.Source { + type AllColumnIdentities = AllColumnIdentities0 + type TableType = T + type ColumnsOut = ColumnsOut0 + } + } + + final case class Joined[FF, A, B]( + joinType: JoinType, + left: Table.Aux[A], + right: Table.Aux[B], + on: Expr[FF, A with B, Boolean] + ) extends Table { + + override type TableType = left.TableType with right.TableType + } + + final case class DerivedTable[CO, +Out, +R <: Read.WithReprs[Out, CO], Source](read: R, name: String) extends Table { + self => + type ColumnsOut = CO + + override type TableType = Source + + def columns(implicit normalizer: TrailingUnitNormalizer[CO]): normalizer.Out = + normalizer.apply(read.columns(name)) + } + + final case class DialectSpecificTable[A](tableExtension: TableExtension[A]) extends Table { + + override type TableType = A + } + + trait TableEx[A] + + type TableExtension[A] <: Table.TableEx[A] + +} diff --git a/core/jvm/src/main/scala/zio/sql/table/TableNameAnnotation.scala b/core/jvm/src/main/scala/zio/sql/table/TableNameAnnotation.scala new file mode 100644 index 000000000..0b43a9a6c --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/table/TableNameAnnotation.scala @@ -0,0 +1,8 @@ +package zio.sql.table + +import scala.annotation.StaticAnnotation + +// TODO add ColumnNameAnnotation +object TableNameAnnotation { + final case class name(name: String) extends StaticAnnotation +} diff --git a/core/jvm/src/main/scala/zio/sql/typetag.scala b/core/jvm/src/main/scala/zio/sql/typetag.scala deleted file mode 100644 index 975d81ba9..000000000 --- a/core/jvm/src/main/scala/zio/sql/typetag.scala +++ /dev/null @@ -1,105 +0,0 @@ -package zio.sql - -import java.sql.ResultSet -import java.time._ -import java.util.UUID -import zio.Chunk - -trait TypeTagModule { self: SelectModule => - - type TypeTagExtension[+A] <: Tag[A] with Decodable[A] - - trait Decodable[+A] { - def decode(column: Int, resultSet: ResultSet): Either[DecodingError, A] - } - - trait Tag[+A] { - private[zio] def cast(a: Any): A = a.asInstanceOf[A] - } - sealed trait TypeTag[+A] extends Tag[A] - - object TypeTag { - sealed trait NotNull[+A] extends TypeTag[A] - implicit case object TBigDecimal extends NotNull[java.math.BigDecimal] - implicit case object TBoolean extends NotNull[Boolean] - implicit case object TByte extends NotNull[Byte] - implicit case object TByteArray extends NotNull[Chunk[Byte]] - implicit case object TChar extends NotNull[Char] - implicit case object TDouble extends NotNull[Double] - implicit case object TFloat extends NotNull[Float] - implicit case object TInstant extends NotNull[Instant] - implicit case object TInt extends NotNull[Int] - implicit case object TLocalDate extends NotNull[LocalDate] - implicit case object TLocalDateTime extends NotNull[LocalDateTime] - implicit case object TLocalTime extends NotNull[LocalTime] - implicit case object TLong extends NotNull[Long] - implicit case object TOffsetDateTime extends NotNull[OffsetDateTime] - implicit case object TOffsetTime extends NotNull[OffsetTime] - implicit case object TShort extends NotNull[Short] - implicit case object TString extends NotNull[String] - implicit case object TUUID extends NotNull[UUID] - implicit case object TZonedDateTime extends NotNull[ZonedDateTime] - - // TODO how to handle dialect specific in tablelike macro ? - sealed case class TDialectSpecific[+A](typeTagExtension: TypeTagExtension[A]) extends NotNull[A] - sealed case class Nullable[A: NotNull]() extends TypeTag[Option[A]] { - def typeTag: TypeTag[A] = implicitly[TypeTag[A]] - } - implicit case object TNone extends TypeTag[None.type] - - implicit def option[A: NotNull]: TypeTag[Option[A]] = Nullable[A]() - - implicit def dialectSpecific[A](implicit typeTagExtension: TypeTagExtension[A]): TypeTag[A] = - TDialectSpecific(typeTagExtension) - } - - sealed trait IsIntegral[A] { - def typeTag: TypeTag[A] - } - - object IsIntegral { - - abstract class AbstractIsIntegral[A: TypeTag] extends IsIntegral[A] { - def typeTag = implicitly[TypeTag[A]] - } - implicit case object TByteIsIntegral extends AbstractIsIntegral[Byte] - implicit case object TShortIsIntegral extends AbstractIsIntegral[Short] - implicit case object TIntIsIntegral extends AbstractIsIntegral[Int] - implicit case object TLongIsIntegral extends AbstractIsIntegral[Long] - } - - sealed trait IsNumeric[A] { - def typeTag: TypeTag[A] - } - - object IsNumeric { - - abstract class AbstractIsNumeric[A: TypeTag] extends IsNumeric[A] { - def typeTag = implicitly[TypeTag[A]] - } - implicit case object TShortIsNumeric extends AbstractIsNumeric[Short] - implicit case object TIntIsNumeric extends AbstractIsNumeric[Int] - implicit case object TLongIsNumeric extends AbstractIsNumeric[Long] - implicit case object TFloatIsNumeric extends AbstractIsNumeric[Float] - implicit case object TDoubleIsNumeric extends AbstractIsNumeric[Double] - // TODO IS BigDecimal numeric? can I work in sql with -, + on `money` type? - implicit case object TBigDecimalIsNumeric extends AbstractIsNumeric[java.math.BigDecimal] - } - - sealed trait IsDate[A] { - def typeTag: TypeTag[A] - } - - object IsDate { - abstract class AbstractIsDate[A: TypeTag] extends IsDate[A] { - def typeTag = implicitly[TypeTag[A]] - } - implicit case object InstantIsDate extends AbstractIsDate[Instant] - implicit case object LocalDateIsDate extends AbstractIsDate[LocalDate] - implicit case object LocalDateTimeIsDate extends AbstractIsDate[LocalDateTime] - implicit case object LocalTimeIsDate extends AbstractIsDate[LocalTime] - implicit case object OffsetDateTimeIsDate extends AbstractIsDate[OffsetDateTime] - implicit case object OffsetTimeIsDate extends AbstractIsDate[OffsetTime] - implicit case object ZonedDateTimeIsDate extends AbstractIsDate[ZonedDateTime] - } -} diff --git a/core/jvm/src/main/scala/zio/sql/typetag/Decodable.scala b/core/jvm/src/main/scala/zio/sql/typetag/Decodable.scala new file mode 100644 index 000000000..86b239b4d --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/typetag/Decodable.scala @@ -0,0 +1,12 @@ +package zio.sql.typetag + +import java.sql.ResultSet +import zio.sql.select.DecodingError + +trait Decodable[+A] { + def decode(column: Int, resultSet: ResultSet): Either[DecodingError, A] +} + +object Decodable { + type TypeTagExtension[+A] <: Tag[A] with Decodable[A] +} \ No newline at end of file diff --git a/core/jvm/src/main/scala/zio/sql/typetag/IsDate.scala b/core/jvm/src/main/scala/zio/sql/typetag/IsDate.scala new file mode 100644 index 000000000..dd1326814 --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/typetag/IsDate.scala @@ -0,0 +1,20 @@ +package zio.sql.typetag + +import java.time._ + +sealed trait IsDate[A] { + def typeTag: TypeTag[A] +} + +object IsDate { + abstract class AbstractIsDate[A: TypeTag] extends IsDate[A] { + def typeTag = implicitly[TypeTag[A]] + } + implicit case object InstantIsDate extends AbstractIsDate[Instant] + implicit case object LocalDateIsDate extends AbstractIsDate[LocalDate] + implicit case object LocalDateTimeIsDate extends AbstractIsDate[LocalDateTime] + implicit case object LocalTimeIsDate extends AbstractIsDate[LocalTime] + implicit case object OffsetDateTimeIsDate extends AbstractIsDate[OffsetDateTime] + implicit case object OffsetTimeIsDate extends AbstractIsDate[OffsetTime] + implicit case object ZonedDateTimeIsDate extends AbstractIsDate[ZonedDateTime] +} diff --git a/core/jvm/src/main/scala/zio/sql/typetag/IsIntegral.scala b/core/jvm/src/main/scala/zio/sql/typetag/IsIntegral.scala new file mode 100644 index 000000000..ec251be6c --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/typetag/IsIntegral.scala @@ -0,0 +1,16 @@ +package zio.sql.typetag + +sealed trait IsIntegral[A] { + def typeTag: TypeTag[A] +} + +object IsIntegral { + + abstract class AbstractIsIntegral[A: TypeTag] extends IsIntegral[A] { + def typeTag = implicitly[TypeTag[A]] + } + implicit case object TByteIsIntegral extends AbstractIsIntegral[Byte] + implicit case object TShortIsIntegral extends AbstractIsIntegral[Short] + implicit case object TIntIsIntegral extends AbstractIsIntegral[Int] + implicit case object TLongIsIntegral extends AbstractIsIntegral[Long] +} \ No newline at end of file diff --git a/core/jvm/src/main/scala/zio/sql/typetag/IsNumeric.scala b/core/jvm/src/main/scala/zio/sql/typetag/IsNumeric.scala new file mode 100644 index 000000000..8333f20a1 --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/typetag/IsNumeric.scala @@ -0,0 +1,19 @@ +package zio.sql.typetag + +sealed trait IsNumeric[A] { + def typeTag: TypeTag[A] +} + +object IsNumeric { + + abstract class AbstractIsNumeric[A: TypeTag] extends IsNumeric[A] { + def typeTag = implicitly[TypeTag[A]] + } + implicit case object TShortIsNumeric extends AbstractIsNumeric[Short] + implicit case object TIntIsNumeric extends AbstractIsNumeric[Int] + implicit case object TLongIsNumeric extends AbstractIsNumeric[Long] + implicit case object TFloatIsNumeric extends AbstractIsNumeric[Float] + implicit case object TDoubleIsNumeric extends AbstractIsNumeric[Double] + // TODO IS BigDecimal numeric? can I work in sql with -, + on `money` type? + implicit case object TBigDecimalIsNumeric extends AbstractIsNumeric[java.math.BigDecimal] +} \ No newline at end of file diff --git a/core/jvm/src/main/scala/zio/sql/typetag/TypeTag.scala b/core/jvm/src/main/scala/zio/sql/typetag/TypeTag.scala new file mode 100644 index 000000000..785ebd125 --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/typetag/TypeTag.scala @@ -0,0 +1,114 @@ +package zio.sql.typetag + +import java.time._ +import java.util.UUID +import zio.Chunk +import zio.schema._ +import zio.sql.typetag.Decodable._ + +trait Tag[+A] { + private[zio] def cast(a: Any): A = a.asInstanceOf[A] +} + +sealed trait TypeTag[+A] extends Tag[A] + +object TypeTag { + sealed trait NotNull[+A] extends TypeTag[A] + implicit case object TBigDecimal extends NotNull[java.math.BigDecimal] + implicit case object TBoolean extends NotNull[Boolean] + implicit case object TByte extends NotNull[Byte] + implicit case object TByteArray extends NotNull[Chunk[Byte]] + implicit case object TChar extends NotNull[Char] + implicit case object TDouble extends NotNull[Double] + implicit case object TFloat extends NotNull[Float] + implicit case object TInstant extends NotNull[Instant] + implicit case object TInt extends NotNull[Int] + implicit case object TLocalDate extends NotNull[LocalDate] + implicit case object TLocalDateTime extends NotNull[LocalDateTime] + implicit case object TLocalTime extends NotNull[LocalTime] + implicit case object TLong extends NotNull[Long] + implicit case object TOffsetDateTime extends NotNull[OffsetDateTime] + implicit case object TOffsetTime extends NotNull[OffsetTime] + implicit case object TShort extends NotNull[Short] + implicit case object TString extends NotNull[String] + implicit case object TUUID extends NotNull[UUID] + implicit case object TZonedDateTime extends NotNull[ZonedDateTime] + + // TODO how to handle dialect specific in tablelike macro ? + final case class TDialectSpecific[+A](typeTagExtension: TypeTagExtension[A]) extends NotNull[A] + final case class Nullable[A: NotNull]() extends TypeTag[Option[A]] { + def typeTag: TypeTag[A] = implicitly[TypeTag[A]] + } + implicit case object TNone extends TypeTag[None.type] + + implicit def option[A: NotNull]: TypeTag[Option[A]] = Nullable[A]() + + implicit def dialectSpecific[A](implicit typeTagExtension: TypeTagExtension[A]): TypeTag[A] = + TDialectSpecific(typeTagExtension) + + def deriveTypeTag[A](standardType: StandardType[A]): Option[TypeTag.NotNull[A]] = + standardType match { + case StandardType.BigDecimalType => Some(TypeTag.TBigDecimal) + case StandardType.BoolType => Some(TypeTag.TBoolean) + case StandardType.ByteType => Some(TypeTag.TByte) + case StandardType.BinaryType => Some(TypeTag.TByteArray) + case StandardType.CharType => Some(TypeTag.TChar) + case StandardType.DoubleType => Some(TypeTag.TDouble) + case StandardType.FloatType => Some(TypeTag.TFloat) + case StandardType.InstantType => Some(TypeTag.TInstant) + case StandardType.IntType => Some(TypeTag.TInt) + case StandardType.LocalDateType => Some(TypeTag.TLocalDate) + case StandardType.LocalDateTimeType => Some(TypeTag.TLocalDateTime) + case StandardType.OffsetTimeType => Some(TypeTag.TOffsetTime) + case StandardType.LocalTimeType => Some(TypeTag.TLocalTime) + case StandardType.LongType => Some(TypeTag.TLong) + case StandardType.OffsetDateTimeType => Some(TypeTag.TOffsetDateTime) + case StandardType.ShortType => Some(TypeTag.TShort) + case StandardType.StringType => Some(TypeTag.TString) + case StandardType.UUIDType => Some(TypeTag.TUUID) + case StandardType.ZonedDateTimeType => Some(TypeTag.TZonedDateTime) + // TODO What other types to support ? + case StandardType.BigIntegerType => None + case StandardType.ZoneOffsetType => None + case StandardType.DurationType => None + case StandardType.YearType => None + case StandardType.MonthType => None + case StandardType.MonthDayType => None + case StandardType.ZoneIdType => None + case StandardType.PeriodType => None + case StandardType.YearMonthType => None + case StandardType.DayOfWeekType => None + case StandardType.UnitType => None + } + + def deriveTypeTag[A](opSchema: Schema.Optional[A]): Option[TypeTag[Option[A]]] = + opSchema.schema match { + case Schema.Primitive(standardType, _) => + implicit val notNullTypeTag = deriveTypeTag(standardType).get + + Some(TypeTag.option[A]) + case _ => None + } + + def deriveTypeTag[A](fieldSchema: Schema[A]): Option[TypeTag[A]] = + fieldSchema match { + case s: Schema.Optional[_] => deriveTypeTag(s) + case s: Schema.Lazy[A] => deriveTypeTag(s.schema) + case Schema.Primitive(standardType, _) => deriveTypeTag(standardType) + case Schema.Sequence(elementSchema, _, _, _, _) => + elementSchema match { + case Schema.Primitive(standardType, _) if (standardType == StandardType.ByteType) => + Some(TypeTag.TByteArray.asInstanceOf[TypeTag[A]]) + case _ => None + } + + // TODO get TypeTag of A available out of Schema[A] and derive typetag from Schema.Transform + case _: Schema.Transform[_, _, _] => None + case _ => None + } +} + + + + + diff --git a/core/jvm/src/main/scala/zio/sql/update.scala b/core/jvm/src/main/scala/zio/sql/update.scala deleted file mode 100644 index dfa8586f6..000000000 --- a/core/jvm/src/main/scala/zio/sql/update.scala +++ /dev/null @@ -1,23 +0,0 @@ -package zio.sql - -trait UpdateModule { self: ExprModule with TableModule with SelectModule => - - sealed case class UpdateBuilder[A](table: Table.Aux[A]) { - def set[F: Features.IsSource, Value: TypeTag](lhs: Expr[F, A, Value], rhs: Expr[_, A, Value]): Update[A] = - Update(table, Set(lhs, rhs) :: Nil, true) - } - - // UPDATE table - // SET foo = bar - // WHERE baz > buzz - // todo `set` must be non-empty - sealed case class Update[A](table: Table.Aux[A], set: List[Set[_, A]], whereExpr: Expr[_, A, Boolean]) { - - def set[F: Features.IsSource, Value: TypeTag](lhs: Expr[F, A, Value], rhs: Expr[_, A, Value]): Update[A] = - copy(set = set :+ Set(lhs, rhs)) - - def where(whereExpr2: Expr[_, A, Boolean]): Update[A] = - copy(whereExpr = whereExpr && whereExpr2) - - } -} diff --git a/core/jvm/src/main/scala/zio/sql/update/Update.scala b/core/jvm/src/main/scala/zio/sql/update/Update.scala new file mode 100644 index 000000000..810c8146b --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/update/Update.scala @@ -0,0 +1,20 @@ +package zio.sql.update + +import zio.sql.table._ +import zio.sql.typetag._ +import zio.sql.Features + +import zio.sql.expr.{Expr, Set} + +// UPDATE table +// SET foo = bar +// WHERE baz > buzz +// todo `set` must be non-empty +final case class Update[A](table: Table.Aux[A], set: List[Set[_, A]], whereExpr: Expr[_, A, Boolean]) { + + def set[F: Features.IsSource, Value: TypeTag](lhs: Expr[F, A, Value], rhs: Expr[_, A, Value]): Update[A] = + copy(set = set :+ Set(lhs, rhs)) + + def where(whereExpr2: Expr[_, A, Boolean]): Update[A] = + copy(whereExpr = whereExpr && whereExpr2) +} diff --git a/core/jvm/src/main/scala/zio/sql/update/UpdateBuilder.scala b/core/jvm/src/main/scala/zio/sql/update/UpdateBuilder.scala new file mode 100644 index 000000000..6c01b8938 --- /dev/null +++ b/core/jvm/src/main/scala/zio/sql/update/UpdateBuilder.scala @@ -0,0 +1,11 @@ +package zio.sql.update + +import zio.sql.table._ +import zio.sql.typetag._ +import zio.sql.Features +import zio.sql.expr._ + +final case class UpdateBuilder[A](table: Table.Aux[A]) { + def set[F: Features.IsSource, Value: TypeTag](lhs: Expr[F, A, Value], rhs: Expr[_, A, Value]): Update[A] = + Update(table, Set(lhs, rhs) :: Nil, true) +} \ No newline at end of file diff --git a/core/jvm/src/main/scala/zio/sql/pluralize.scala b/core/jvm/src/main/scala/zio/sql/utils/Pluralize.scala similarity index 99% rename from core/jvm/src/main/scala/zio/sql/pluralize.scala rename to core/jvm/src/main/scala/zio/sql/utils/Pluralize.scala index 86746fd03..c7dc94ec8 100644 --- a/core/jvm/src/main/scala/zio/sql/pluralize.scala +++ b/core/jvm/src/main/scala/zio/sql/utils/Pluralize.scala @@ -1,4 +1,4 @@ -package zio.sql +package zio.sql.utils import scala.util.matching.Regex diff --git a/core/jvm/src/main/scala/zio/sql/utils.scala b/core/jvm/src/main/scala/zio/sql/utils/TrailingUnitNormalizer.scala similarity index 99% rename from core/jvm/src/main/scala/zio/sql/utils.scala rename to core/jvm/src/main/scala/zio/sql/utils/TrailingUnitNormalizer.scala index c5723fe67..06ffc23c2 100644 --- a/core/jvm/src/main/scala/zio/sql/utils.scala +++ b/core/jvm/src/main/scala/zio/sql/utils/TrailingUnitNormalizer.scala @@ -1,6 +1,6 @@ -package zio.sql +package zio.sql.utils + -trait UtilsModule { self => sealed trait TrailingUnitNormalizer[In] { type Out @@ -165,5 +165,4 @@ trait UtilsModule { self => (in._1, in._2._1, in._2._2._1, in._2._2._2._1, in._2._2._2._2._1, in._2._2._2._2._2._1, in._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._1) } // format: on - } -} + } \ No newline at end of file diff --git a/core/jvm/src/test/scala/zio/sql/PluralizeSpec.scala b/core/jvm/src/test/scala/zio/sql/PluralizeSpec.scala index 05950b64f..17daa08fe 100644 --- a/core/jvm/src/test/scala/zio/sql/PluralizeSpec.scala +++ b/core/jvm/src/test/scala/zio/sql/PluralizeSpec.scala @@ -2,6 +2,7 @@ package zio.sql import zio.test._ import zio.Scope +import zio.sql.utils.Pluralize object PluralizeSpec extends ZIOSpecDefault { diff --git a/core/jvm/src/test/scala/zio/sql/ProductSchema.scala b/core/jvm/src/test/scala/zio/sql/ProductSchema.scala index 6d42ce2ec..57e2e4c8d 100644 --- a/core/jvm/src/test/scala/zio/sql/ProductSchema.scala +++ b/core/jvm/src/test/scala/zio/sql/ProductSchema.scala @@ -4,14 +4,19 @@ import zio.schema.Schema import java.time.LocalDate import zio.schema.DeriveSchema import zio.schema.StandardType +import zio.sql.table._ +import zio.sql.insert._ +import zio.sql.select._ +import zio.sql.update._ +import zio.sql.delete._ object ProductSchema { val sql = new Sql { self => - override def renderDelete(delete: self.Delete[_]): String = ??? - override def renderRead(read: self.Read[_]): String = ??? - override def renderUpdate(update: self.Update[_]): String = ??? + override def renderDelete(delete: Delete[_]): String = ??? + override def renderRead(read: Read[_]): String = ??? + override def renderUpdate(update: Update[_]): String = ??? - override def renderInsert[A: Schema](insert: self.Insert[_, A]): String = ??? + override def renderInsert[A: Schema](insert: Insert[_, A]): String = ??? } import sql._ @@ -30,7 +35,7 @@ object ProductSchema { implicit val productsSchema = DeriveSchema.gen[Product] - val productTable = defineTable[Product] + val productTable = Table.defineTable[Product] val (id, lastUpdated, name, baseAmount, finalAmount, deleted) = productTable.columns diff --git a/core/jvm/src/test/scala/zio/sql/TestBasicSelectSpec.scala b/core/jvm/src/test/scala/zio/sql/TestBasicSelectSpec.scala index 9e0fa75f6..cc92eb9d8 100644 --- a/core/jvm/src/test/scala/zio/sql/TestBasicSelectSpec.scala +++ b/core/jvm/src/test/scala/zio/sql/TestBasicSelectSpec.scala @@ -6,13 +6,18 @@ import zio.schema._ import zio.test.ZIOSpecDefault import zio.schema.DeriveSchema import java.time.LocalDate +import zio.sql.table._ +import zio.sql.select._ +import zio.sql.insert._ +import zio.sql.update._ +import zio.sql.delete._ object TestBasicSelect { val userSql = new Sql { self => - override def renderDelete(delete: self.Delete[_]): String = ??? - override def renderRead(read: self.Read[_]): String = ??? - override def renderUpdate(update: self.Update[_]): String = ??? - override def renderInsert[A: Schema](insert: self.Insert[_, A]): String = ??? + override def renderDelete(delete: Delete[_]): String = ??? + override def renderRead(read: Read[_]): String = ??? + override def renderUpdate(update: Update[_]): String = ??? + override def renderInsert[A: Schema](insert: Insert[_, A]): String = ??? case class Users(user_id: String, dob: LocalDate, first_name: String, last_name: String) @@ -20,7 +25,7 @@ object TestBasicSelect { Schema.primitive[LocalDate](StandardType.LocalDateType) implicit val userSchema = DeriveSchema.gen[Users] - val userTable = defineTable[Users] + val userTable = Table.defineTable[Users] val (userId, dob, fName, lName) = userTable.columns diff --git a/postgres/src/main/scala/zio/sql/postgresql/PostgresSqlModule.scala b/postgres/src/main/scala/zio/sql/postgresql/PostgresSqlModule.scala index 66d18bb3d..a9ecb434b 100644 --- a/postgres/src/main/scala/zio/sql/postgresql/PostgresSqlModule.scala +++ b/postgres/src/main/scala/zio/sql/postgresql/PostgresSqlModule.scala @@ -21,7 +21,7 @@ trait PostgresSqlModule extends Sql { self => object PostgresSpecificTable { import scala.language.implicitConversions - sealed case class LateraLTable[A, B](left: Table.Aux[A], right: Table.Aux[B]) + final case class LateraLTable[A, B](left: Table.Aux[A], right: Table.Aux[B]) extends PostgresSpecificTable[A with B] implicit def tableSourceToSelectedBuilder[A]( @@ -29,7 +29,7 @@ trait PostgresSqlModule extends Sql { self => ): LateralTableBuilder[A] = new LateralTableBuilder(table) - sealed case class LateralTableBuilder[A](left: Table.Aux[A]) { + final case class LateralTableBuilder[A](left: Table.Aux[A]) { self => final def lateral[Reprs, Out, B]( @@ -91,7 +91,7 @@ trait PostgresSqlModule extends Sql { self => } } - sealed case class Timestampz( + final case class Timestampz( year: Int = 0, month: Int = 0, day: Int = 0, @@ -105,7 +105,7 @@ trait PostgresSqlModule extends Sql { self => } // Based upon https://github.com/tminglei/slick-pg/blob/master/src/main/scala/com/github/tminglei/slickpg/PgDateSupport.scala - sealed case class Interval( + final case class Interval( years: Int = 0, months: Int = 0, days: Int = 0, diff --git a/sqlserver/src/main/scala/zio/sql/sqlserver/SqlServerSqlModule.scala b/sqlserver/src/main/scala/zio/sql/sqlserver/SqlServerSqlModule.scala index 067c58ede..d739db7bd 100644 --- a/sqlserver/src/main/scala/zio/sql/sqlserver/SqlServerSqlModule.scala +++ b/sqlserver/src/main/scala/zio/sql/sqlserver/SqlServerSqlModule.scala @@ -22,7 +22,7 @@ trait SqlServerSqlModule extends Sql { self => case object OuterApply extends CrossType } - sealed case class CrossOuterApplyTable[A, B]( + final case class CrossOuterApplyTable[A, B]( crossType: CrossType, left: Table.Aux[A], right: Table.Aux[B] @@ -33,7 +33,7 @@ trait SqlServerSqlModule extends Sql { self => ): CrossOuterApplyTableBuilder[A] = new CrossOuterApplyTableBuilder(table) - sealed case class CrossOuterApplyTableBuilder[A](left: Table.Aux[A]) { + final case class CrossOuterApplyTableBuilder[A](left: Table.Aux[A]) { self => final def crossApply[Reprs, Out, RightSource]( From 1ef0d8c8d97c190d90a998cc35e69bddd41f7b37 Mon Sep 17 00:00:00 2001 From: sviezypan Date: Thu, 16 Feb 2023 21:34:05 +0100 Subject: [PATCH 2/5] project compiles for 2.13 --- core/jvm/src/main/scala/zio/sql/Sql.scala | 2 +- .../scala/zio/sql/expr/AggregationDef.scala | 1 + .../src/main/scala/zio/sql/table/Table.scala | 5 +-- .../scala/zio/sql/typetag/Decodable.scala | 4 --- .../main/scala/zio/sql/typetag/TypeTag.scala | 5 ++- .../src/main/scala/zio/sql/Examples.scala | 17 +++++----- .../main/scala/zio/sql/GroupByExamples.scala | 5 +-- .../scala/zio/sql/JdbcInternalModule.scala | 2 ++ .../scala/zio/sql/SqlDriverLiveModule.scala | 4 +++ ...le.scala => TransactionSyntaxModule.scala} | 6 +++- jdbc/src/main/scala/zio/sql/jdbc.scala | 6 +++- .../zio/sql/mysql/MysqlRenderModule.scala | 31 +++++++++++------- .../scala/zio/sql/mysql/MysqlSqlModule.scala | 7 ++-- .../zio/sql/mysql/CommonFunctionDefSpec.scala | 5 +-- .../zio/sql/mysql/CustomFunctionDefSpec.scala | 3 +- .../test/scala/zio/sql/mysql/DeleteSpec.scala | 3 +- .../scala/zio/sql/mysql/MysqlModuleSpec.scala | 12 +++---- .../scala/zio/sql/mysql/TransactionSpec.scala | 3 +- .../zio/sql/oracle/OracleRenderModule.scala | 32 ++++++++++++------- .../zio/sql/oracle/OracleSqlModule.scala | 6 ++-- .../sql/oracle/CommonFunctionDefSpec.scala | 5 +-- .../scala/zio/sql/oracle/ShopSchema.scala | 11 ++++--- .../sql/postgresql/PostgresRenderModule.scala | 28 ++++++++++------ .../sql/postgresql/PostgresSqlModule.scala | 25 ++++++++------- .../zio/sql/postgresql/AgregationSpec.scala | 5 ++- .../postgresql/CommonFunctionDefSpec.scala | 6 ++-- .../postgresql/CustomFunctionDefSpec.scala | 13 +------- .../scala/zio/sql/postgresql/DbSchema.scala | 20 ++++++------ .../zio/sql/postgresql/DeleteBatchSpec.scala | 2 +- .../scala/zio/sql/postgresql/DeleteSpec.scala | 3 +- .../postgresql/PostgresSqlModuleSpec.scala | 5 +-- .../zio/sql/postgresql/UpdateBatchSpec.scala | 2 +- .../sql/sqlserver/SqlServerRenderModule.scala | 25 ++++++++++----- .../sql/sqlserver/SqlServerSqlModule.scala | 13 ++++---- .../sql/sqlserver/CommonFunctionDefSpec.scala | 8 +---- .../scala/zio/sql/sqlserver/DbSchema.scala | 10 +++--- .../sql/sqlserver/SqlServerModuleSpec.scala | 21 ++++++------ 37 files changed, 201 insertions(+), 160 deletions(-) rename jdbc/src/main/scala/zio/sql/{ExprSyntaxModule.scala => TransactionSyntaxModule.scala} (83%) diff --git a/core/jvm/src/main/scala/zio/sql/Sql.scala b/core/jvm/src/main/scala/zio/sql/Sql.scala index 0c98824c3..38beb29ba 100644 --- a/core/jvm/src/main/scala/zio/sql/Sql.scala +++ b/core/jvm/src/main/scala/zio/sql/Sql.scala @@ -61,5 +61,5 @@ trait Sql { }, someA => Right(someA) ) - implicit val none: Schema[None.type] = Schema.singleton(None) + implicit val none: Schema[None.type] = Schema.singleton(None) } diff --git a/core/jvm/src/main/scala/zio/sql/expr/AggregationDef.scala b/core/jvm/src/main/scala/zio/sql/expr/AggregationDef.scala index 7f9f31304..dbc713da6 100644 --- a/core/jvm/src/main/scala/zio/sql/expr/AggregationDef.scala +++ b/core/jvm/src/main/scala/zio/sql/expr/AggregationDef.scala @@ -2,6 +2,7 @@ package zio.sql.expr import zio.sql.typetag.TypeTag import zio.sql.Features +import java.math.BigDecimal final case class AggregationDef[-A, +B](name: FunctionName) { self => diff --git a/core/jvm/src/main/scala/zio/sql/table/Table.scala b/core/jvm/src/main/scala/zio/sql/table/Table.scala index 778f40b14..88452ffc7 100644 --- a/core/jvm/src/main/scala/zio/sql/table/Table.scala +++ b/core/jvm/src/main/scala/zio/sql/table/Table.scala @@ -192,8 +192,5 @@ object Table { override type TableType = A } - trait TableEx[A] - - type TableExtension[A] <: Table.TableEx[A] - + trait TableExtension[A] } diff --git a/core/jvm/src/main/scala/zio/sql/typetag/Decodable.scala b/core/jvm/src/main/scala/zio/sql/typetag/Decodable.scala index 86b239b4d..b7a593088 100644 --- a/core/jvm/src/main/scala/zio/sql/typetag/Decodable.scala +++ b/core/jvm/src/main/scala/zio/sql/typetag/Decodable.scala @@ -5,8 +5,4 @@ import zio.sql.select.DecodingError trait Decodable[+A] { def decode(column: Int, resultSet: ResultSet): Either[DecodingError, A] -} - -object Decodable { - type TypeTagExtension[+A] <: Tag[A] with Decodable[A] } \ No newline at end of file diff --git a/core/jvm/src/main/scala/zio/sql/typetag/TypeTag.scala b/core/jvm/src/main/scala/zio/sql/typetag/TypeTag.scala index 785ebd125..6c812a881 100644 --- a/core/jvm/src/main/scala/zio/sql/typetag/TypeTag.scala +++ b/core/jvm/src/main/scala/zio/sql/typetag/TypeTag.scala @@ -4,7 +4,7 @@ import java.time._ import java.util.UUID import zio.Chunk import zio.schema._ -import zio.sql.typetag.Decodable._ +import zio.sql.typetag.Decodable trait Tag[+A] { private[zio] def cast(a: Any): A = a.asInstanceOf[A] @@ -13,6 +13,9 @@ trait Tag[+A] { sealed trait TypeTag[+A] extends Tag[A] object TypeTag { + + trait TypeTagExtension[+A] extends Tag[A] with Decodable[A] + sealed trait NotNull[+A] extends TypeTag[A] implicit case object TBigDecimal extends NotNull[java.math.BigDecimal] implicit case object TBoolean extends NotNull[Boolean] diff --git a/examples/src/main/scala/zio/sql/Examples.scala b/examples/src/main/scala/zio/sql/Examples.scala index 4fe7fb7ea..6de30718a 100644 --- a/examples/src/main/scala/zio/sql/Examples.scala +++ b/examples/src/main/scala/zio/sql/Examples.scala @@ -4,13 +4,14 @@ import java.util.UUID import java.time._ import zio.sql.postgresql.PostgresJdbcModule import zio.schema.DeriveSchema +import zio.sql.expr.AggregationDef._ +import zio.sql.expr.FunctionDef._ +import zio.sql.table._ object Examples extends App with PostgresJdbcModule { - import this.AggregationDef._ - import this.FunctionDef._ - import this.OrderDetails._ - import this.Orders._ - import this.Users._ + import Orders._ + import Users._ + import OrderDetails._ val basicSelect = select(fName, lName).from(users) @@ -173,7 +174,7 @@ object Examples extends App with PostgresJdbcModule { implicit val userSchema = DeriveSchema.gen[Users] - val users = defineTable[Users] + val users = Table.defineTable[Users] val (userId, age, dob, fName, lName) = users.columns } @@ -184,7 +185,7 @@ object Examples extends App with PostgresJdbcModule { implicit val orderSchema = DeriveSchema.gen[Orders] - val orders = defineTable[Orders] + val orders = Table.defineTable[Orders] val (orderId, fkUserId, orderDate) = orders.columns } @@ -194,7 +195,7 @@ object Examples extends App with PostgresJdbcModule { implicit val orderDetailSchema = DeriveSchema.gen[OrderDetail] - val orderDetails = defineTable[OrderDetail] + val orderDetails = Table.defineTable[OrderDetail] val (fkOrderId, fkProductId, quantity, unitPrice) = orderDetails.columns } diff --git a/examples/src/main/scala/zio/sql/GroupByExamples.scala b/examples/src/main/scala/zio/sql/GroupByExamples.scala index fac6d445e..e29738640 100644 --- a/examples/src/main/scala/zio/sql/GroupByExamples.scala +++ b/examples/src/main/scala/zio/sql/GroupByExamples.scala @@ -2,15 +2,16 @@ package zio.sql import zio.schema.DeriveSchema import zio.sql.postgresql.PostgresJdbcModule +import zio.sql.expr.AggregationDef._ +import zio.sql.table._ object GroupByExamples extends App with PostgresJdbcModule { - import AggregationDef._ case class Product(id: Int, name: String, amount: Int, price: Double) implicit val productSchema = DeriveSchema.gen[Product] - val productTable = defineTable[Product] + val productTable = Table.defineTable[Product] val (id, name, amount, price) = productTable.columns diff --git a/jdbc/src/main/scala/zio/sql/JdbcInternalModule.scala b/jdbc/src/main/scala/zio/sql/JdbcInternalModule.scala index 47dafe657..ff3074a03 100644 --- a/jdbc/src/main/scala/zio/sql/JdbcInternalModule.scala +++ b/jdbc/src/main/scala/zio/sql/JdbcInternalModule.scala @@ -3,6 +3,8 @@ package zio.sql import java.sql._ import java.time.{ OffsetDateTime, OffsetTime, ZoneId, ZoneOffset } import zio.Chunk +import zio.sql.select._ +import zio.sql.typetag._ trait JdbcInternalModule { self: Jdbc => diff --git a/jdbc/src/main/scala/zio/sql/SqlDriverLiveModule.scala b/jdbc/src/main/scala/zio/sql/SqlDriverLiveModule.scala index e282d14d7..2db3dfdf6 100644 --- a/jdbc/src/main/scala/zio/sql/SqlDriverLiveModule.scala +++ b/jdbc/src/main/scala/zio/sql/SqlDriverLiveModule.scala @@ -6,6 +6,10 @@ import zio._ import zio.stream.{ Stream, ZStream } import zio.schema.Schema import zio.IO +import zio.sql.update._ +import zio.sql.select._ +import zio.sql.insert._ +import zio.sql.delete._ trait SqlDriverLiveModule { self: Jdbc => private[sql] trait SqlDriverCore { diff --git a/jdbc/src/main/scala/zio/sql/ExprSyntaxModule.scala b/jdbc/src/main/scala/zio/sql/TransactionSyntaxModule.scala similarity index 83% rename from jdbc/src/main/scala/zio/sql/ExprSyntaxModule.scala rename to jdbc/src/main/scala/zio/sql/TransactionSyntaxModule.scala index 5092fbaf6..3548c6846 100644 --- a/jdbc/src/main/scala/zio/sql/ExprSyntaxModule.scala +++ b/jdbc/src/main/scala/zio/sql/TransactionSyntaxModule.scala @@ -3,8 +3,12 @@ package zio.sql import zio._ import zio.stream.ZStream import zio.schema.Schema +import zio.sql.update._ +import zio.sql.select._ +import zio.sql.insert._ +import zio.sql.delete._ -trait ExprSyntaxModule { self: Jdbc => +trait TransactionSyntaxModule { self: Jdbc => implicit final class ReadSyntax[A](self: Read[A]) { def run: ZStream[SqlTransaction, Exception, A] = ZStream.serviceWithStream(_.read(self)) diff --git a/jdbc/src/main/scala/zio/sql/jdbc.scala b/jdbc/src/main/scala/zio/sql/jdbc.scala index 1d79d4b44..575d04e36 100644 --- a/jdbc/src/main/scala/zio/sql/jdbc.scala +++ b/jdbc/src/main/scala/zio/sql/jdbc.scala @@ -4,8 +4,12 @@ import zio._ import zio.stream._ import zio.schema.Schema import zio.sql.macros.GroupByLike +import zio.sql.update._ +import zio.sql.select._ +import zio.sql.insert._ +import zio.sql.delete._ -trait Jdbc extends zio.sql.Sql with JdbcInternalModule with SqlDriverLiveModule with ExprSyntaxModule { +trait Jdbc extends Sql with JdbcInternalModule with SqlDriverLiveModule with TransactionSyntaxModule { trait SqlDriver { def delete(delete: Delete[_]): IO[Exception, Int] diff --git a/mysql/src/main/scala/zio/sql/mysql/MysqlRenderModule.scala b/mysql/src/main/scala/zio/sql/mysql/MysqlRenderModule.scala index c84d0966d..a26eee463 100644 --- a/mysql/src/main/scala/zio/sql/mysql/MysqlRenderModule.scala +++ b/mysql/src/main/scala/zio/sql/mysql/MysqlRenderModule.scala @@ -7,28 +7,35 @@ import zio.Chunk import zio.schema._ import zio.schema.StandardType._ import zio.sql.driver.Renderer +import zio.sql.update._ +import zio.sql.select._ +import zio.sql.insert._ +import zio.sql.delete._ +import zio.sql.expr._ +import zio.sql.table._ +import zio.sql.typetag._ trait MysqlRenderModule extends MysqlSqlModule { self => - override def renderRead(read: self.Read[_]): String = { + override def renderRead(read: Read[_]): String = { implicit val render: Renderer = Renderer() MysqlRenderer.renderReadImpl(read) render.toString } - override def renderInsert[A: Schema](insert: self.Insert[_, A]): String = { + override def renderInsert[A: Schema](insert: Insert[_, A]): String = { implicit val render: Renderer = Renderer() MysqlRenderer.renderInsertImpl(insert) render.toString } - override def renderDelete(delete: self.Delete[_]): String = { + override def renderDelete(delete: Delete[_]): String = { implicit val render: Renderer = Renderer() MysqlRenderer.renderDeleteImpl(delete) render.toString } - override def renderUpdate(update: self.Update[_]): String = { + override def renderUpdate(update: Update[_]): String = { implicit val render: Renderer = Renderer() MysqlRenderer.renderUpdateImpl(update) render.toString @@ -62,7 +69,7 @@ trait MysqlRenderModule extends MysqlSqlModule { self => renderWhereExpr(whereExpr) } - def renderReadImpl(read: self.Read[_])(implicit render: Renderer): Unit = + def renderReadImpl(read: Read[_])(implicit render: Renderer): Unit = read match { case Read.Mapped(read, _) => renderReadImpl(read) @@ -250,7 +257,7 @@ trait MysqlRenderModule extends MysqlSqlModule { self => table match { case Table.DialectSpecificTable(_) => ??? // The outer reference in this type test cannot be checked at run time?! - case sourceTable: self.Table.Source => + case sourceTable: Table.Source => render(sourceTable.name) case Table.DerivedTable(read, name) => render(" ( ") @@ -273,14 +280,14 @@ trait MysqlRenderModule extends MysqlSqlModule { self => private[zio] def quoted(name: String): String = "\"" + name + "\"" - private def renderExpr[A, B](expr: self.Expr[_, A, B])(implicit render: Renderer): Unit = expr match { + private def renderExpr[A, B](expr: Expr[_, A, B])(implicit render: Renderer): Unit = expr match { case Expr.Subselect(subselect) => render(" (") renderRead(subselect) render(") ") case Expr.Source(table, column) => (table, column.name) match { - case (tableName: TableName, Some(columnName)) => render(tableName, ".", columnName) + case (tableName: String, Some(columnName)) => render(tableName, ".", columnName) case _ => () } case Expr.Unary(base, op) => @@ -402,15 +409,15 @@ trait MysqlRenderModule extends MysqlSqlModule { self => render(")") } - private def renderLit[A, B](lit: self.Expr.Literal[_])(implicit render: Renderer): Unit = { + private def renderLit[A, B](lit: Expr.Literal[_])(implicit render: Renderer): Unit = { import MysqlSpecific.MysqlTypeTag._ import TypeTag._ lit.typeTag match { case TDialectSpecific(tt) => tt match { - case tt @ TYear => + case tt @ TYear => render(tt.cast(lit.value)) - case _: MysqlSpecific.MysqlTypeTag[_] => ??? + case _ => ??? } case TByteArray => render( @@ -531,7 +538,7 @@ trait MysqlRenderModule extends MysqlSqlModule { self => * Drops the initial Litaral(true) present at the start of every WHERE expressions by default * and proceeds to the rest of Expr's. */ - private def renderWhereExpr[A, B](expr: self.Expr[_, A, B])(implicit render: Renderer): Unit = expr match { + private def renderWhereExpr[A, B](expr: Expr[_, A, B])(implicit render: Renderer): Unit = expr match { case Expr.Literal(true) => () case Expr.Binary(_, b, _) => render(" WHERE ") diff --git a/mysql/src/main/scala/zio/sql/mysql/MysqlSqlModule.scala b/mysql/src/main/scala/zio/sql/mysql/MysqlSqlModule.scala index eb611d6e8..a8b7dd466 100644 --- a/mysql/src/main/scala/zio/sql/mysql/MysqlSqlModule.scala +++ b/mysql/src/main/scala/zio/sql/mysql/MysqlSqlModule.scala @@ -4,13 +4,14 @@ import java.time._ import java.sql.ResultSet import java.util.UUID import zio.sql.Sql +import zio.sql.select._ +import zio.sql.expr._ +import zio.sql.typetag._ trait MysqlSqlModule extends Sql { self => - override type TypeTagExtension[+A] = MysqlSpecific.MysqlTypeTag[A] - object MysqlSpecific { - trait MysqlTypeTag[+A] extends Tag[A] with Decodable[A] + trait MysqlTypeTag[+A] extends TypeTag.TypeTagExtension[A] object MysqlTypeTag { implicit case object TYear extends MysqlTypeTag[Year] { diff --git a/mysql/src/test/scala/zio/sql/mysql/CommonFunctionDefSpec.scala b/mysql/src/test/scala/zio/sql/mysql/CommonFunctionDefSpec.scala index cf215241d..953588441 100644 --- a/mysql/src/test/scala/zio/sql/mysql/CommonFunctionDefSpec.scala +++ b/mysql/src/test/scala/zio/sql/mysql/CommonFunctionDefSpec.scala @@ -8,15 +8,16 @@ import zio.sql.Jdbc import java.util.UUID import java.time.LocalDate import zio.schema._ +import zio.sql.expr.FunctionDef.{ CharLength => _, _ } +import zio.sql.table._ object CommonFunctionDefSpec extends MysqlRunnableSpec with Jdbc { - import FunctionDef.{ CharLength => _, _ } case class Customers(id: UUID, dob: LocalDate, first_name: String, last_name: String, verified: Boolean) implicit val customerSchema = DeriveSchema.gen[Customers] - val customers = defineTable[Customers] + val customers = Table.defineTable[Customers] val (customerId, dob, fName, lName, verified) = customers.columns diff --git a/mysql/src/test/scala/zio/sql/mysql/CustomFunctionDefSpec.scala b/mysql/src/test/scala/zio/sql/mysql/CustomFunctionDefSpec.scala index 6de4cebfa..34f512f73 100644 --- a/mysql/src/test/scala/zio/sql/mysql/CustomFunctionDefSpec.scala +++ b/mysql/src/test/scala/zio/sql/mysql/CustomFunctionDefSpec.scala @@ -7,6 +7,7 @@ import java.time.{ LocalDate, LocalTime, ZoneId } import java.time.format.DateTimeFormatter import zio.sql.Jdbc import java.util.UUID +import zio.sql.table._ object CustomFunctionDefSpec extends MysqlRunnableSpec with Jdbc { @@ -16,7 +17,7 @@ object CustomFunctionDefSpec extends MysqlRunnableSpec with Jdbc { implicit val customerSchema = DeriveSchema.gen[Customers] - val customers = defineTable[Customers] + val customers = Table.defineTable[Customers] val (customerId, dob, fName, lName, verified) = customers.columns diff --git a/mysql/src/test/scala/zio/sql/mysql/DeleteSpec.scala b/mysql/src/test/scala/zio/sql/mysql/DeleteSpec.scala index 93713a80c..057a3f7e8 100644 --- a/mysql/src/test/scala/zio/sql/mysql/DeleteSpec.scala +++ b/mysql/src/test/scala/zio/sql/mysql/DeleteSpec.scala @@ -6,6 +6,7 @@ import java.util.UUID import java.time.LocalDate import zio.schema.DeriveSchema import zio.test.TestAspect.sequential +import zio.sql.table._ object DeleteSpec extends MysqlRunnableSpec { @@ -13,7 +14,7 @@ object DeleteSpec extends MysqlRunnableSpec { implicit val customerSchema = DeriveSchema.gen[Customers] - val customers = defineTable[Customers] + val customers = Table.defineTable[Customers] val (_, _, _, lastName, verified) = customers.columns diff --git a/mysql/src/test/scala/zio/sql/mysql/MysqlModuleSpec.scala b/mysql/src/test/scala/zio/sql/mysql/MysqlModuleSpec.scala index 416689c95..d3a423b6a 100644 --- a/mysql/src/test/scala/zio/sql/mysql/MysqlModuleSpec.scala +++ b/mysql/src/test/scala/zio/sql/mysql/MysqlModuleSpec.scala @@ -8,8 +8,9 @@ import zio.test._ import zio.test.Assertion._ import zio.test.TestAspect._ import java.math.BigDecimal - +import zio.sql.table._ import scala.language.postfixOps +import zio.sql.expr.AggregationDef._ object MysqlModuleSpec extends MysqlRunnableSpec { @@ -17,7 +18,7 @@ object MysqlModuleSpec extends MysqlRunnableSpec { implicit val customerSchema = DeriveSchema.gen[Customers] - val customers = defineTable[Customers] + val customers = Table.defineTable[Customers] val (customerId, dob, fName, lName, verified) = customers.columns @@ -25,14 +26,14 @@ object MysqlModuleSpec extends MysqlRunnableSpec { implicit val orderSchema = DeriveSchema.gen[Orders] - val orders = defineTable[Orders] + val orders = Table.defineTable[Orders] val (orderId, fkCustomerId, orderDate, deletedAt) = orders.columns case class ProductPrice(productId: UUID, effective: LocalDate, price: BigDecimal) implicit val productPriceSchema = DeriveSchema.gen[ProductPrice] - val productPrices = defineTableSmart[ProductPrice] + val productPrices = Table.defineTableSmart[ProductPrice] val (productPricesOrderId, effectiveDate, productPrice) = productPrices.columns @@ -40,7 +41,7 @@ object MysqlModuleSpec extends MysqlRunnableSpec { implicit val orderDetailsSchema = DeriveSchema.gen[OrderDetails] - val orderDetails = defineTableSmart[OrderDetails] + val orderDetails = Table.defineTableSmart[OrderDetails] val (orderDetailsOrderId, orderDetailsProductId, quantity, unitPrice) = orderDetails.columns @@ -206,7 +207,6 @@ object MysqlModuleSpec extends MysqlRunnableSpec { * Uncomment it when aggregation function handling is fixed. */ test("Can count rows") { - import AggregationDef._ val query = select(Count(customerId)) from customers for { diff --git a/mysql/src/test/scala/zio/sql/mysql/TransactionSpec.scala b/mysql/src/test/scala/zio/sql/mysql/TransactionSpec.scala index 8c38812e9..b22d8ca8b 100644 --- a/mysql/src/test/scala/zio/sql/mysql/TransactionSpec.scala +++ b/mysql/src/test/scala/zio/sql/mysql/TransactionSpec.scala @@ -9,6 +9,7 @@ import zio.test._ import zio.test.TestAspect.sequential import java.time.LocalDate import zio.sql.Jdbc +import zio.sql.table._ object TransactionSpec extends MysqlRunnableSpec with Jdbc { @@ -16,7 +17,7 @@ object TransactionSpec extends MysqlRunnableSpec with Jdbc { implicit val customerSchema = DeriveSchema.gen[Customers] - val customers = defineTable[Customers] + val customers = Table.defineTable[Customers] val (customerId, dob, fName, lName, verified) = customers.columns diff --git a/oracle/src/main/scala/zio/sql/oracle/OracleRenderModule.scala b/oracle/src/main/scala/zio/sql/oracle/OracleRenderModule.scala index 759644fdd..279628906 100644 --- a/oracle/src/main/scala/zio/sql/oracle/OracleRenderModule.scala +++ b/oracle/src/main/scala/zio/sql/oracle/OracleRenderModule.scala @@ -19,28 +19,36 @@ import java.time.YearMonth import java.time.Duration import java.time.format.{ DateTimeFormatter, DateTimeFormatterBuilder } import java.time.temporal.ChronoField._ +import zio.sql.update._ +import zio.sql.select._ +import zio.sql.insert._ +import zio.sql.delete._ +import zio.sql.expr._ +import zio.sql.table._ +import zio.sql.typetag._ +import zio.sql.ops.Operator._ trait OracleRenderModule extends OracleSqlModule { self => - override def renderDelete(delete: self.Delete[_]): String = { + override def renderDelete(delete: Delete[_]): String = { val builder = new StringBuilder buildDeleteString(delete, builder) builder.toString } - override def renderInsert[A: Schema](insert: self.Insert[_, A]): String = { + override def renderInsert[A: Schema](insert: Insert[_, A]): String = { val builder = new StringBuilder buildInsertString(insert, builder) builder.toString() } - override def renderRead(read: self.Read[_]): String = { + override def renderRead(read: Read[_]): String = { val builder = new StringBuilder buildReadString(read, builder) builder.toString() } - override def renderUpdate(update: self.Update[_]): String = { + override def renderUpdate(update: Update[_]): String = { implicit val render: Renderer = Renderer() OracleRender.renderUpdateImpl(update) render.toString @@ -74,7 +82,7 @@ trait OracleRenderModule extends OracleSqlModule { self => .toFormatter() } - private def buildLit(lit: self.Expr.Literal[_])(builder: StringBuilder): Unit = { + private def buildLit(lit: Expr.Literal[_])(builder: StringBuilder): Unit = { import TypeTag._ val value = lit.value lit.typeTag match { @@ -146,14 +154,14 @@ trait OracleRenderModule extends OracleSqlModule { self => } // TODO: to consider the refactoring and using the implicit `Renderer`, see `renderExpr` in `PostgresRenderModule` - private def buildExpr[A, B](expr: self.Expr[_, A, B], builder: StringBuilder): Unit = expr match { + private def buildExpr[A, B](expr: Expr[_, A, B], builder: StringBuilder): Unit = expr match { case Expr.Subselect(subselect) => builder.append(" (") builder.append(renderRead(subselect)) val _ = builder.append(") ") case Expr.Source(table, column) => (table, column.name) match { - case (tableName: TableName, Some(columnName)) => + case (tableName: String, Some(columnName)) => val _ = builder.append(tableName).append(".").append(columnName) case _ => () } @@ -283,7 +291,7 @@ trait OracleRenderModule extends OracleSqlModule { self => * Drops the initial Litaral(true) present at the start of every WHERE expressions by default * and proceeds to the rest of Expr's. */ - private def buildWhereExpr[A, B](expr: self.Expr[_, A, B], builder: mutable.StringBuilder): Unit = expr match { + private def buildWhereExpr[A, B](expr: Expr[_, A, B], builder: mutable.StringBuilder): Unit = expr match { case Expr.Literal(true) => () case Expr.Binary(_, b, _) => builder.append(" WHERE ") @@ -293,7 +301,7 @@ trait OracleRenderModule extends OracleSqlModule { self => buildExpr(expr, builder) } - private def buildReadString(read: self.Read[_], builder: StringBuilder): Unit = + private def buildReadString(read: Read[_], builder: StringBuilder): Unit = read match { case Read.Mapped(read, _) => buildReadString(read, builder) @@ -358,7 +366,7 @@ trait OracleRenderModule extends OracleSqlModule { self => val _ = builder.append(" (").append(values.mkString(",")).append(") ") // todo fix needs escaping } - private def buildInsertString[A: Schema](insert: self.Insert[_, A], builder: StringBuilder): Unit = { + private def buildInsertString[A: Schema](insert: Insert[_, A], builder: StringBuilder): Unit = { builder.append("INSERT INTO ") renderTable(insert.table, builder) @@ -648,7 +656,7 @@ trait OracleRenderModule extends OracleSqlModule { self => table match { case Table.DialectSpecificTable(_) => ??? // The outer reference in this type test cannot be checked at run time?! - case sourceTable: self.Table.Source => + case sourceTable: Table.Source => val _ = builder.append(sourceTable.name) case Table.DerivedTable(read, name) => builder.append(" ( ") @@ -702,7 +710,7 @@ trait OracleRenderModule extends OracleSqlModule { self => case Nil => // TODO restrict Update to not allow empty set } - private[zio] def renderSetLhs[A, B](expr: self.Expr[_, A, B])(implicit render: Renderer): Unit = + private[zio] def renderSetLhs[A, B](expr: Expr[_, A, B])(implicit render: Renderer): Unit = expr match { case Expr.Source(table, column) => (table, column.name) match { diff --git a/oracle/src/main/scala/zio/sql/oracle/OracleSqlModule.scala b/oracle/src/main/scala/zio/sql/oracle/OracleSqlModule.scala index 68c9dabe4..de022e416 100644 --- a/oracle/src/main/scala/zio/sql/oracle/OracleSqlModule.scala +++ b/oracle/src/main/scala/zio/sql/oracle/OracleSqlModule.scala @@ -5,11 +5,13 @@ import java.time.YearMonth import java.sql.ResultSet import scala.util.Try import java.time.Duration +import zio.sql.select._ +import zio.sql.expr._ +import zio.sql.typetag._ trait OracleSqlModule extends Sql { self => - override type TypeTagExtension[+A] = OracleTypeTag[A] - trait OracleTypeTag[+A] extends Tag[A] with Decodable[A] + trait OracleTypeTag[+A] extends TypeTag.TypeTagExtension[A] object OracleTypeTag { implicit case object TYearMonth extends OracleTypeTag[YearMonth] { diff --git a/oracle/src/test/scala/zio/sql/oracle/CommonFunctionDefSpec.scala b/oracle/src/test/scala/zio/sql/oracle/CommonFunctionDefSpec.scala index 97c7433ea..1ffb4f6d2 100644 --- a/oracle/src/test/scala/zio/sql/oracle/CommonFunctionDefSpec.scala +++ b/oracle/src/test/scala/zio/sql/oracle/CommonFunctionDefSpec.scala @@ -5,14 +5,15 @@ import zio.stream.ZStream import zio.test.Assertion._ import zio.test._ import zio.schema.DeriveSchema +import zio.sql.expr.FunctionDef.{ CharLength => _, _ } +import zio.sql.table._ object CommonFunctionDefSpec extends OracleRunnableSpec with ShopSchema { - import FunctionDef.{ CharLength => _, _ } import Customers._ case class Dual(dummy: String) implicit val dummySchema = DeriveSchema.gen[Dual] - val dual = defineTable[Dual] + val dual = Table.defineTable[Dual] val dommy = dual.columns private def collectAndCompare[R, E]( diff --git a/oracle/src/test/scala/zio/sql/oracle/ShopSchema.scala b/oracle/src/test/scala/zio/sql/oracle/ShopSchema.scala index 2e23d5f93..c9049a2f8 100644 --- a/oracle/src/test/scala/zio/sql/oracle/ShopSchema.scala +++ b/oracle/src/test/scala/zio/sql/oracle/ShopSchema.scala @@ -5,6 +5,7 @@ import java.time._ import zio.Chunk import zio.schema.DeriveSchema import java.math.BigDecimal +import zio.sql.table._ trait ShopSchema extends OracleSqlModule { self => @@ -14,7 +15,7 @@ trait ShopSchema extends OracleSqlModule { self => implicit val customerSchema = DeriveSchema.gen[Customers] - val customers = defineTableSmart[Customers] + val customers = Table.defineTableSmart[Customers] val (customerId, dob, fName, lName, verified) = customers.columns } @@ -23,7 +24,7 @@ trait ShopSchema extends OracleSqlModule { self => implicit val orderSchema = DeriveSchema.gen[Order] - val orders = defineTableSmart[Order] + val orders = Table.defineTableSmart[Order] val (orderId, fkCustomerId, orderDate) = orders.columns } @@ -32,7 +33,7 @@ trait ShopSchema extends OracleSqlModule { self => case class ProductPrice(productId: UUID, effective: LocalDate, price: BigDecimal) implicit val productPriceSchema = DeriveSchema.gen[ProductPrice] - val productPrices = defineTableSmart[ProductPrice] + val productPrices = Table.defineTableSmart[ProductPrice] val (productPricesOrderId, effectiveDate, productPrice) = productPrices.columns } @@ -42,7 +43,7 @@ trait ShopSchema extends OracleSqlModule { self => implicit val orderDetailsSchema = DeriveSchema.gen[OrderDetails] - val orderDetails = defineTableSmart[OrderDetails] + val orderDetails = Table.defineTableSmart[OrderDetails] val (orderDetailsOrderId, orderDetailsProductId, quantity, unitPrice) = orderDetails.columns } @@ -74,7 +75,7 @@ trait ShopSchema extends OracleSqlModule { self => implicit val alTypesSchema = DeriveSchema.gen[AllType] - val allTypes = defineTableSmart[AllType] + val allTypes = Table.defineTableSmart[AllType] val ( id, diff --git a/postgres/src/main/scala/zio/sql/postgresql/PostgresRenderModule.scala b/postgres/src/main/scala/zio/sql/postgresql/PostgresRenderModule.scala index cc090bd0d..63545a098 100644 --- a/postgres/src/main/scala/zio/sql/postgresql/PostgresRenderModule.scala +++ b/postgres/src/main/scala/zio/sql/postgresql/PostgresRenderModule.scala @@ -8,10 +8,17 @@ import zio.schema._ import zio.schema.StandardType._ import zio.sql.driver.Renderer import java.time.format.DateTimeFormatter._ +import zio.sql.update._ +import zio.sql.select._ +import zio.sql.insert._ +import zio.sql.delete._ +import zio.sql.expr._ +import zio.sql.table._ +import zio.sql.typetag._ trait PostgresRenderModule extends PostgresSqlModule { self => - override def renderRead(read: self.Read[_]): String = { + override def renderRead(read: Read[_]): String = { implicit val render: Renderer = Renderer() PostgresRenderer.renderReadImpl(read) render.toString @@ -23,7 +30,7 @@ trait PostgresRenderModule extends PostgresSqlModule { self => render.toString } - override def renderInsert[A: Schema](insert: self.Insert[_, A]): String = { + override def renderInsert[A: Schema](insert: Insert[_, A]): String = { implicit val render: Renderer = Renderer() PostgresRenderer.renderInsertImpl(insert) render.toString @@ -191,7 +198,7 @@ trait PostgresRenderModule extends PostgresSqlModule { self => case Nil => // TODO restrict Update to not allow empty set } - private[zio] def renderLit[A, B](lit: self.Expr.Literal[_])(implicit render: Renderer): Unit = + private[zio] def renderLit[A, B](lit: Expr.Literal[_])(implicit render: Renderer): Unit = renderLit(lit.typeTag, lit.value) private[zio] def renderLit(typeTag: TypeTag[_], value: Any)(implicit render: Renderer): Unit = { @@ -213,7 +220,7 @@ trait PostgresRenderModule extends PostgresSqlModule { self => typeTagExtension match { case tt @ TInterval => render(tt.cast(value)) case tt @ TTimestampz => render(tt.cast(value)) - case _: PostgresSpecific.PostgresTypeTag[_] => ??? + case _ => ??? } case TByteArray => render( @@ -237,7 +244,7 @@ trait PostgresRenderModule extends PostgresSqlModule { self => * PostgreSQL doesn't allow for `tableName.columnName = value` format in update statement, * instead requires `columnName = value`. */ - private[zio] def renderSetLhs[A, B](expr: self.Expr[_, A, B])(implicit render: Renderer): Unit = + private[zio] def renderSetLhs[A, B](expr: Expr[_, A, B])(implicit render: Renderer): Unit = expr match { case Expr.Source(_, column) => column.name match { @@ -249,14 +256,14 @@ trait PostgresRenderModule extends PostgresSqlModule { self => private[zio] def quoted(name: String): String = "\"" + name + "\"" - private[zio] def renderExpr[A, B](expr: self.Expr[_, A, B])(implicit render: Renderer): Unit = expr match { + private[zio] def renderExpr[A, B](expr: Expr[_, A, B])(implicit render: Renderer): Unit = expr match { case Expr.Subselect(subselect) => render(" (") render(renderRead(subselect)) render(") ") case e @ Expr.Source(table, column) => (table, column.name) match { - case (tableName: TableName, Some(columnName)) => + case (tableName: String, Some(columnName)) => render(quoted(tableName), ".", quoted(columnName)) case _ => () } @@ -383,7 +390,7 @@ trait PostgresRenderModule extends PostgresSqlModule { self => render(")") } - private[zio] def renderReadImpl(read: self.Read[_])(implicit render: Renderer): Unit = + private[zio] def renderReadImpl(read: Read[_])(implicit render: Renderer): Unit = read match { case Read.Mapped(read, _) => renderReadImpl(read) @@ -523,9 +530,10 @@ trait PostgresRenderModule extends PostgresSqlModule { self => render(" ,lateral ") renderTable(derivedTable) + case _ => ??? } // The outer reference in this type test cannot be checked at run time?! - case sourceTable: self.Table.Source => render(quoted(sourceTable.name)) + case sourceTable: Table.Source => render(quoted(sourceTable.name)) case Table.DerivedTable(read, name) => render(" ( ") render(renderRead(read.asInstanceOf[Read[_]])) @@ -549,7 +557,7 @@ trait PostgresRenderModule extends PostgresSqlModule { self => * Drops the initial Litaral(true) present at the start of every WHERE expressions by default * and proceeds to the rest of Expr's. */ - private def renderWhereExpr[A, B](expr: self.Expr[_, A, B])(implicit render: Renderer): Unit = expr match { + private def renderWhereExpr[A, B](expr: Expr[_, A, B])(implicit render: Renderer): Unit = expr match { case Expr.Literal(true) => () case Expr.Binary(_, b, _) => render(" WHERE ") diff --git a/postgres/src/main/scala/zio/sql/postgresql/PostgresSqlModule.scala b/postgres/src/main/scala/zio/sql/postgresql/PostgresSqlModule.scala index a9ecb434b..cafc58215 100644 --- a/postgres/src/main/scala/zio/sql/postgresql/PostgresSqlModule.scala +++ b/postgres/src/main/scala/zio/sql/postgresql/PostgresSqlModule.scala @@ -7,21 +7,21 @@ import java.util.{ Calendar, UUID } import org.postgresql.util.PGInterval import zio.Chunk import zio.sql.Sql +import zio.sql.typetag._ +import zio.sql.table._ +import zio.sql.select._ +import zio.sql.expr._ trait PostgresSqlModule extends Sql { self => import TypeTag._ - override type TypeTagExtension[+A] = PostgresSpecific.PostgresTypeTag[A] - - override type TableExtension[A] = PostgresSpecific.PostgresSpecificTable[A] - object PostgresSpecific { - sealed trait PostgresSpecificTable[A] extends Table.TableEx[A] + sealed trait PostgresSpecificTable[A] extends Table.TableExtension[A] object PostgresSpecificTable { import scala.language.implicitConversions - final case class LateraLTable[A, B](left: Table.Aux[A], right: Table.Aux[B]) + sealed case class LateraLTable[A, B](left: Table.Aux[A], right: Table.Aux[B]) extends PostgresSpecificTable[A with B] implicit def tableSourceToSelectedBuilder[A]( @@ -29,7 +29,7 @@ trait PostgresSqlModule extends Sql { self => ): LateralTableBuilder[A] = new LateralTableBuilder(table) - final case class LateralTableBuilder[A](left: Table.Aux[A]) { + sealed case class LateralTableBuilder[A](left: Table.Aux[A]) { self => final def lateral[Reprs, Out, B]( @@ -46,7 +46,10 @@ trait PostgresSqlModule extends Sql { self => } } - trait PostgresTypeTag[+A] extends Tag[A] with Decodable[A] + //could not find implicit value for evidence parameter of type + // zio.sql.typetag.TypeTag[zio.sql.postgresql.CustomFunctionDefSpec.PostgresSpecific.Interval] + + trait PostgresTypeTag[+A] extends TypeTagExtension[A] object PostgresTypeTag { implicit case object TVoid extends PostgresTypeTag[Unit] { override def decode(column: Int, resultSet: ResultSet): Either[DecodingError, Unit] = @@ -57,7 +60,7 @@ trait PostgresSqlModule extends Sql { self => _ => Right(()) ) } - implicit case object TInterval extends PostgresTypeTag[Interval] { + implicit case object TInterval extends TypeTagExtension[Interval] { override def decode( column: Int, resultSet: ResultSet @@ -91,7 +94,7 @@ trait PostgresSqlModule extends Sql { self => } } - final case class Timestampz( + sealed case class Timestampz( year: Int = 0, month: Int = 0, day: Int = 0, @@ -105,7 +108,7 @@ trait PostgresSqlModule extends Sql { self => } // Based upon https://github.com/tminglei/slick-pg/blob/master/src/main/scala/com/github/tminglei/slickpg/PgDateSupport.scala - final case class Interval( + sealed case class Interval( years: Int = 0, months: Int = 0, days: Int = 0, diff --git a/postgres/src/test/scala/zio/sql/postgresql/AgregationSpec.scala b/postgres/src/test/scala/zio/sql/postgresql/AgregationSpec.scala index 2e649a2a6..6fdb26253 100644 --- a/postgres/src/test/scala/zio/sql/postgresql/AgregationSpec.scala +++ b/postgres/src/test/scala/zio/sql/postgresql/AgregationSpec.scala @@ -2,19 +2,18 @@ package zio.sql.postgresql import zio.test.TestAspect._ import zio.test._ - +import zio.sql.expr.AggregationDef._ import java.math.{ BigDecimal, RoundingMode } import java.util.UUID object AgregationSpec extends PostgresRunnableSpec with DbSchema { - import AggregationDef._ import OrderDetailsSchema._ override def specLayered = suite("Postgres module with aggregate function SumInt, SumDec and avgDec ")( test("Can aggregate colums SumInt(Int column) and SumDec(BigDdecimal colum)") { - + val query = select((SumDec(unitPrice) as "totalAmount"), (SumInt(quantity) as "soldQuantity")) .from(orderDetails) .where(orderDetailsProductId === UUID.fromString("7368ABF4-AED2-421F-B426-1725DE756895")) diff --git a/postgres/src/test/scala/zio/sql/postgresql/CommonFunctionDefSpec.scala b/postgres/src/test/scala/zio/sql/postgresql/CommonFunctionDefSpec.scala index 0ece7e610..2a8d54ee1 100644 --- a/postgres/src/test/scala/zio/sql/postgresql/CommonFunctionDefSpec.scala +++ b/postgres/src/test/scala/zio/sql/postgresql/CommonFunctionDefSpec.scala @@ -4,9 +4,10 @@ import zio.stream.ZStream import zio.test.Assertion._ import zio.test._ import zio.Cause +import zio.sql.expr.FunctionDef.{ CharLength => _, _ } object CommonFunctionDefSpec extends PostgresRunnableSpec with DbSchema { - import FunctionDef.{ CharLength => _, _ } + import CustomerSchema._ private def collectAndCompare[R, E]( @@ -34,7 +35,6 @@ object CommonFunctionDefSpec extends PostgresRunnableSpec with DbSchema { collectAndCompare(expected, testResult) }, test("concat_ws #3 - combine columns and flat values") { - import Expr._ val query = select(ConcatWs4(" ", "Person:", fName, lName)) from customers @@ -50,7 +50,6 @@ object CommonFunctionDefSpec extends PostgresRunnableSpec with DbSchema { collectAndCompare(expected, testResult) }, test("concat_ws #3 - combine function calls together") { - import Expr._ val query = select( ConcatWs3(" and ", Concat("Name: ", fName), Concat("Surname: ", lName)) @@ -116,7 +115,6 @@ object CommonFunctionDefSpec extends PostgresRunnableSpec with DbSchema { ), suite("Schema independent tests")( test("concat_ws #1 - combine flat values") { - import Expr._ // note: a plain number (3) would and should not compile val query = select(ConcatWs4("+", "1", "2", "3")) diff --git a/postgres/src/test/scala/zio/sql/postgresql/CustomFunctionDefSpec.scala b/postgres/src/test/scala/zio/sql/postgresql/CustomFunctionDefSpec.scala index 44bc59d88..92e565eae 100644 --- a/postgres/src/test/scala/zio/sql/postgresql/CustomFunctionDefSpec.scala +++ b/postgres/src/test/scala/zio/sql/postgresql/CustomFunctionDefSpec.scala @@ -15,6 +15,7 @@ object CustomFunctionDefSpec extends PostgresRunnableSpec with DbSchema { import CustomerSchema._ import PostgresFunctionDef._ import PostgresSpecific._ + import PostgresSpecific.PostgresTypeTag._ private def collectAndCompare[R, E]( expected: Seq[String], @@ -48,8 +49,6 @@ object CustomFunctionDefSpec extends PostgresRunnableSpec with DbSchema { }, suite("format function")( test("format0") { - import Expr._ - val query = select(Format0("Person")) val expected = Seq("Person") @@ -58,8 +57,6 @@ object CustomFunctionDefSpec extends PostgresRunnableSpec with DbSchema { collectAndCompare(expected, testResult) }, test("format1") { - import Expr._ - val query = select(Format1("Person: %s", fName)) from customers val expected = Seq( @@ -74,8 +71,6 @@ object CustomFunctionDefSpec extends PostgresRunnableSpec with DbSchema { collectAndCompare(expected, testResult) }, test("format2") { - import Expr._ - val query = select(Format2("Person: %s %s", fName, lName)) from customers val expected = Seq( @@ -90,8 +85,6 @@ object CustomFunctionDefSpec extends PostgresRunnableSpec with DbSchema { collectAndCompare(expected, testResult) }, test("format3") { - import Expr._ - val query = select( Format3("Person: %s %s with double quoted %I ", fName, lName, "identi fier") ) from customers @@ -108,8 +101,6 @@ object CustomFunctionDefSpec extends PostgresRunnableSpec with DbSchema { collectAndCompare(expected, testResult) }, test("format4") { - import Expr._ - val query = select( Format4( "Person: %s %s with null-literal %L and non-null-literal %L ", @@ -132,8 +123,6 @@ object CustomFunctionDefSpec extends PostgresRunnableSpec with DbSchema { collectAndCompare(expected, testResult) }, test("format5") { - import Expr._ - val query = select( Format5( "Person: %s %s with more arguments than placeholders: %I %L ", diff --git a/postgres/src/test/scala/zio/sql/postgresql/DbSchema.scala b/postgres/src/test/scala/zio/sql/postgresql/DbSchema.scala index ccabdf99e..e3466b497 100644 --- a/postgres/src/test/scala/zio/sql/postgresql/DbSchema.scala +++ b/postgres/src/test/scala/zio/sql/postgresql/DbSchema.scala @@ -4,6 +4,8 @@ import java.time.{ LocalDate, ZonedDateTime } import java.util.UUID import zio.schema.DeriveSchema import java.math.BigDecimal +import zio.sql.table._ +import zio.sql.select._ trait DbSchema extends PostgresJdbcModule { self => @@ -14,18 +16,18 @@ trait DbSchema extends PostgresJdbcModule { self => implicit val citySchema = DeriveSchema.gen[City] - val city = defineTable[City] + val city = Table.defineTable[City] val (cityId, cityName, population, area, link) = city.columns implicit val metroSystemSchema = DeriveSchema.gen[MetroSystem] - val metroSystem = defineTable[MetroSystem] + val metroSystem = Table.defineTable[MetroSystem] val (metroSystemId, cityIdFk, metroSystemName, dailyRidership) = metroSystem.columns implicit val metroLineSchema = DeriveSchema.gen[MetroLine] - val metroLine = defineTable[MetroLine] + val metroLine = Table.defineTable[MetroLine] val (metroLineId, systemId, metroLineName, stationCount, trackType) = metroLine.columns } @@ -64,7 +66,7 @@ trait DbSchema extends PostgresJdbcModule { self => implicit val custommerSchema = DeriveSchema.gen[Customer] - val customers = defineTableSmart[Customer] + val customers = Table.defineTableSmart[Customer] val (customerId, dob, fName, lName, verified, createdString, createdTimestamp) = customers.columns @@ -77,7 +79,7 @@ trait DbSchema extends PostgresJdbcModule { self => implicit val orderSchema = DeriveSchema.gen[Orders] - val orders = defineTableSmart[Orders] + val orders = Table.defineTableSmart[Orders] val (orderId, fkCustomerId, orderDate) = orders.columns } @@ -87,7 +89,7 @@ trait DbSchema extends PostgresJdbcModule { self => implicit val productSchema = DeriveSchema.gen[Products] - val products = defineTableSmart[Products] + val products = Table.defineTableSmart[Products] val (productId, productName, description, imageURL) = products.columns } @@ -96,7 +98,7 @@ trait DbSchema extends PostgresJdbcModule { self => case class ProductPrice(productId: UUID, effective: LocalDate, price: BigDecimal) implicit val productPriceSchema = DeriveSchema.gen[ProductPrice] - val productPrices = defineTableSmart[ProductPrice] + val productPrices = Table.defineTableSmart[ProductPrice] val (productPricesOrderId, effectiveDate, productPrice) = productPrices.columns } @@ -106,7 +108,7 @@ trait DbSchema extends PostgresJdbcModule { self => implicit val orderDetailsSchema = DeriveSchema.gen[OrderDetails] - val orderDetails = defineTableSmart[OrderDetails] + val orderDetails = Table.defineTableSmart[OrderDetails] val (orderDetailsOrderId, orderDetailsProductId, quantity, unitPrice) = orderDetails.columns } @@ -116,7 +118,7 @@ trait DbSchema extends PostgresJdbcModule { self => implicit val personsSchema = DeriveSchema.gen[Persons] - val persons = defineTableSmart[Persons] + val persons = Table.defineTableSmart[Persons] val (personsId, personsName, birthDate) = persons.columns } diff --git a/postgres/src/test/scala/zio/sql/postgresql/DeleteBatchSpec.scala b/postgres/src/test/scala/zio/sql/postgresql/DeleteBatchSpec.scala index 005921803..8e7efb1a5 100644 --- a/postgres/src/test/scala/zio/sql/postgresql/DeleteBatchSpec.scala +++ b/postgres/src/test/scala/zio/sql/postgresql/DeleteBatchSpec.scala @@ -4,7 +4,7 @@ import zio.Cause import zio.test.Assertion._ import zio.test.TestAspect._ import zio.test._ - +import zio.sql.delete._ import java.time.{ LocalDate, ZonedDateTime } import java.util.UUID diff --git a/postgres/src/test/scala/zio/sql/postgresql/DeleteSpec.scala b/postgres/src/test/scala/zio/sql/postgresql/DeleteSpec.scala index eefb94754..37c21866c 100644 --- a/postgres/src/test/scala/zio/sql/postgresql/DeleteSpec.scala +++ b/postgres/src/test/scala/zio/sql/postgresql/DeleteSpec.scala @@ -5,6 +5,7 @@ import java.util.UUID import java.time.LocalDate import java.time.ZonedDateTime import zio.schema.DeriveSchema +import zio.sql.table._ object DeleteSpec extends PostgresRunnableSpec { @@ -20,7 +21,7 @@ object DeleteSpec extends PostgresRunnableSpec { implicit val custommerSchema = DeriveSchema.gen[Customers] - val customers = defineTable[Customers] + val customers = Table.defineTable[Customers] val (customerId, dob, fName, lName, verified, createdString, createdTimestamp) = customers.columns diff --git a/postgres/src/test/scala/zio/sql/postgresql/PostgresSqlModuleSpec.scala b/postgres/src/test/scala/zio/sql/postgresql/PostgresSqlModuleSpec.scala index 7b0ccfb19..833750ab9 100644 --- a/postgres/src/test/scala/zio/sql/postgresql/PostgresSqlModuleSpec.scala +++ b/postgres/src/test/scala/zio/sql/postgresql/PostgresSqlModuleSpec.scala @@ -9,12 +9,13 @@ import zio.schema._ import zio.test._ import zio.test.Assertion._ import zio.test.TestAspect._ - +import zio.sql.expr.AggregationDef._ +import zio.sql.expr._ +import zio.sql.select._ import scala.language.postfixOps object PostgresSqlModuleSpec extends PostgresRunnableSpec with DbSchema { - import AggregationDef._ import CustomerSchema._ private def customerSelectJoseAssertion[F]( diff --git a/postgres/src/test/scala/zio/sql/postgresql/UpdateBatchSpec.scala b/postgres/src/test/scala/zio/sql/postgresql/UpdateBatchSpec.scala index 95217414c..cd1b1cae2 100644 --- a/postgres/src/test/scala/zio/sql/postgresql/UpdateBatchSpec.scala +++ b/postgres/src/test/scala/zio/sql/postgresql/UpdateBatchSpec.scala @@ -3,7 +3,7 @@ package zio.sql.postgresql import zio.Cause import zio.test.Assertion._ import zio.test._ - +import zio.sql.update._ import java.time.{ LocalDate, ZonedDateTime } import java.util.UUID diff --git a/sqlserver/src/main/scala/zio/sql/sqlserver/SqlServerRenderModule.scala b/sqlserver/src/main/scala/zio/sql/sqlserver/SqlServerRenderModule.scala index d9b1bedc4..63f24f44f 100644 --- a/sqlserver/src/main/scala/zio/sql/sqlserver/SqlServerRenderModule.scala +++ b/sqlserver/src/main/scala/zio/sql/sqlserver/SqlServerRenderModule.scala @@ -7,10 +7,18 @@ import zio.sql.driver.Renderer import java.time.format.DateTimeFormatter._ import java.time.format.{ DateTimeFormatter, DateTimeFormatterBuilder } import java.time._ +import zio.sql.update._ +import zio.sql.select._ +import zio.sql.insert._ +import zio.sql.delete._ +import zio.sql.expr._ +import zio.sql.table._ +import zio.sql.typetag._ +import zio.sql.ops.Operator._ trait SqlServerRenderModule extends SqlServerSqlModule { self => - override def renderRead(read: self.Read[_]): String = { + override def renderRead(read: Read[_]): String = { implicit val render: Renderer = Renderer() SqlServerRenderer.renderReadImpl(read) render.toString @@ -22,7 +30,7 @@ trait SqlServerRenderModule extends SqlServerSqlModule { self => render.toString } - override def renderInsert[A: Schema](insert: self.Insert[_, A]): String = { + override def renderInsert[A: Schema](insert: Insert[_, A]): String = { implicit val render: Renderer = Renderer() SqlServerRenderer.renderInsertImpl(insert) render.toString @@ -47,7 +55,7 @@ trait SqlServerRenderModule extends SqlServerSqlModule { self => .appendOffset("+HH:MM", "Z") .toFormatter() - private[zio] def renderReadImpl(read: self.Read[_])(implicit render: Renderer): Unit = + private[zio] def renderReadImpl(read: Read[_])(implicit render: Renderer): Unit = read match { // case Read.Mapped(read, _) => renderReadImpl(read.asInstanceOf[Read[Out]]) case Read.Mapped(read, _) => renderReadImpl(read) @@ -106,7 +114,7 @@ trait SqlServerRenderModule extends SqlServerSqlModule { self => render(" (", values.mkString(","), ") ") // todo fix needs escaping } - private def renderLit(lit: self.Expr.Literal[_])(implicit render: Renderer): Unit = { + private def renderLit(lit: Expr.Literal[_])(implicit render: Renderer): Unit = { import TypeTag._ val value = lit.value lit.typeTag match { @@ -149,14 +157,14 @@ trait SqlServerRenderModule extends SqlServerSqlModule { self => } } - private def buildExpr[A, B](expr: self.Expr[_, A, B])(implicit render: Renderer): Unit = expr match { + private def buildExpr[A, B](expr: Expr[_, A, B])(implicit render: Renderer): Unit = expr match { case Expr.Subselect(subselect) => render(" (") render(renderRead(subselect)) render(") ") case Expr.Source(table, column) => (table, column.name) match { - case (tableName: TableName, Some(columnName)) => + case (tableName: String, Some(columnName)) => render(tableName, ".", columnName) case _ => () } @@ -365,7 +373,7 @@ trait SqlServerRenderModule extends SqlServerSqlModule { self => render(" ) ") render(name) - case sourceTable: self.Table.Source => + case sourceTable: Table.Source => render(sourceTable.name) case Table.DialectSpecificTable(tableExtension) => @@ -379,6 +387,7 @@ trait SqlServerRenderModule extends SqlServerSqlModule { self => } val _ = buildTable(derivedTable) + case _ => ??? } case Table.Joined(joinType, left, right, on) => @@ -399,7 +408,7 @@ trait SqlServerRenderModule extends SqlServerSqlModule { self => * Drops the initial Litaral(true) present at the start of every WHERE expressions by default * and proceeds to the rest of Expr's. */ - private def buildWhereExpr[A, B](expr: self.Expr[_, A, B])(implicit render: Renderer): Unit = expr match { + private def buildWhereExpr[A, B](expr: Expr[_, A, B])(implicit render: Renderer): Unit = expr match { case Expr.Literal(true) => () case Expr.Binary(_, b, _) => render(" WHERE ") diff --git a/sqlserver/src/main/scala/zio/sql/sqlserver/SqlServerSqlModule.scala b/sqlserver/src/main/scala/zio/sql/sqlserver/SqlServerSqlModule.scala index d739db7bd..fdc93c0b0 100644 --- a/sqlserver/src/main/scala/zio/sql/sqlserver/SqlServerSqlModule.scala +++ b/sqlserver/src/main/scala/zio/sql/sqlserver/SqlServerSqlModule.scala @@ -1,16 +1,17 @@ package zio.sql.sqlserver import java.math.BigDecimal - +import zio.sql.table._ +import zio.sql.select._ import zio.sql.Sql +import zio.sql.expr.FunctionName +import zio.sql.expr.AggregationDef trait SqlServerSqlModule extends Sql { self => - override type TableExtension[A] = SqlServerSpecific.SqlServerTable[A] - object SqlServerSpecific { - sealed trait SqlServerTable[A] extends Table.TableEx[A] + sealed trait SqlServerTable[A] extends Table.TableExtension[A] object SqlServerTable { @@ -22,7 +23,7 @@ trait SqlServerSqlModule extends Sql { self => case object OuterApply extends CrossType } - final case class CrossOuterApplyTable[A, B]( + sealed case class CrossOuterApplyTable[A, B]( crossType: CrossType, left: Table.Aux[A], right: Table.Aux[B] @@ -33,7 +34,7 @@ trait SqlServerSqlModule extends Sql { self => ): CrossOuterApplyTableBuilder[A] = new CrossOuterApplyTableBuilder(table) - final case class CrossOuterApplyTableBuilder[A](left: Table.Aux[A]) { + sealed case class CrossOuterApplyTableBuilder[A](left: Table.Aux[A]) { self => final def crossApply[Reprs, Out, RightSource]( diff --git a/sqlserver/src/test/scala/zio/sql/sqlserver/CommonFunctionDefSpec.scala b/sqlserver/src/test/scala/zio/sql/sqlserver/CommonFunctionDefSpec.scala index 907d8e33c..cf1fa5b51 100644 --- a/sqlserver/src/test/scala/zio/sql/sqlserver/CommonFunctionDefSpec.scala +++ b/sqlserver/src/test/scala/zio/sql/sqlserver/CommonFunctionDefSpec.scala @@ -4,9 +4,9 @@ import zio.Cause import zio.stream.ZStream import zio.test.Assertion._ import zio.test._ +import zio.sql.expr.FunctionDef.{ CharLength => _, _ } object CommonFunctionDefSpec extends SqlServerRunnableSpec with DbSchema { - import FunctionDef.{ CharLength => _, _ } import DbSchema._ private def collectAndCompare[R, E]( @@ -34,8 +34,6 @@ object CommonFunctionDefSpec extends SqlServerRunnableSpec with DbSchema { collectAndCompare(expected, testResult) }, test("concat_ws #3 - combine columns and flat values") { - import Expr._ - val query = select(ConcatWs4(" ", "Person:", fName, lName)) from customers val expected = Seq( @@ -50,8 +48,6 @@ object CommonFunctionDefSpec extends SqlServerRunnableSpec with DbSchema { collectAndCompare(expected, testResult) }, test("concat_ws #3 - combine function calls together") { - import Expr._ - val query = select( ConcatWs3(" and ", Concat("Name: ", fName), Concat("Surname: ", lName)) ) from customers @@ -116,8 +112,6 @@ object CommonFunctionDefSpec extends SqlServerRunnableSpec with DbSchema { ), suite("Schema independent tests")( test("concat_ws #1 - combine flat values") { - import Expr._ - // note: a plain number (3) would and should not compile val query = select(ConcatWs4("+", "1", "2", "3")) diff --git a/sqlserver/src/test/scala/zio/sql/sqlserver/DbSchema.scala b/sqlserver/src/test/scala/zio/sql/sqlserver/DbSchema.scala index 50b29be15..060d59298 100644 --- a/sqlserver/src/test/scala/zio/sql/sqlserver/DbSchema.scala +++ b/sqlserver/src/test/scala/zio/sql/sqlserver/DbSchema.scala @@ -4,6 +4,8 @@ import java.util.UUID import java.time._ import java.math.BigDecimal import zio.schema.DeriveSchema +import zio.sql.table._ +import zio.sql.select._ trait DbSchema extends SqlServerSqlModule { self => @@ -21,7 +23,7 @@ trait DbSchema extends SqlServerSqlModule { self => implicit val custommerSchema = DeriveSchema.gen[Customer] - val customers = defineTableSmart[Customer] + val customers = Table.defineTableSmart[Customer] val (customerId, dob, fName, lName, verified, createdString, createdTimestamp) = customers.columns @@ -32,7 +34,7 @@ trait DbSchema extends SqlServerSqlModule { self => implicit val orderSchema = DeriveSchema.gen[Orders] - val orders = defineTableSmart[Orders] + val orders = Table.defineTableSmart[Orders] val (orderId, fkCustomerId, orderDate) = orders.columns @@ -40,7 +42,7 @@ trait DbSchema extends SqlServerSqlModule { self => implicit val productSchema = DeriveSchema.gen[Products] - val products = defineTableSmart[Products] + val products = Table.defineTableSmart[Products] val (productId, productName, description, imageURL) = products.columns @@ -48,7 +50,7 @@ trait DbSchema extends SqlServerSqlModule { self => implicit val orderDetailsSchema = DeriveSchema.gen[OrderDetails] - val orderDetails = defineTableSmart[OrderDetails] + val orderDetails = Table.defineTableSmart[OrderDetails] val (orderDetailsId, orderDetailsProductId, quantity, unitPrice) = orderDetails.columns diff --git a/sqlserver/src/test/scala/zio/sql/sqlserver/SqlServerModuleSpec.scala b/sqlserver/src/test/scala/zio/sql/sqlserver/SqlServerModuleSpec.scala index e94b7cdbb..f9a721f79 100644 --- a/sqlserver/src/test/scala/zio/sql/sqlserver/SqlServerModuleSpec.scala +++ b/sqlserver/src/test/scala/zio/sql/sqlserver/SqlServerModuleSpec.scala @@ -9,12 +9,14 @@ import zio.schema.DeriveSchema import zio.test._ import zio.test.Assertion._ import zio.test.TestAspect.{ retries, samples, sequential, shrinks } - +import zio.sql.expr.Expr +import zio.sql.table._ +import zio.sql.select._ +import zio.sql.expr.AggregationDef._ import scala.language.postfixOps object SqlServerModuleSpec extends SqlServerRunnableSpec { - import AggregationDef._ import CustomerSchema._ final case class CustomerRow( @@ -596,9 +598,6 @@ object SqlServerModuleSpec extends SqlServerRunnableSpec { } yield assert(r)(hasSameElementsDistinct(crossOuterApplyExpected)) }, test("handle isTrue to 1 bit type") { - - import AggregationDef._ - val query = select(Count(customerId)) .from(customers) @@ -609,8 +608,6 @@ object SqlServerModuleSpec extends SqlServerRunnableSpec { } yield assertTrue(result == 4L) }, test("handle isNotTrue to 0 bit type") { - import AggregationDef._ - val query = select(Count(customerId)) .from(customers) @@ -959,7 +956,7 @@ object SqlServerModuleSpec extends SqlServerRunnableSpec { implicit val customerSchema = DeriveSchema.gen[Customers] - val customers = defineTable[Customers] + val customers = Table.defineTable[Customers] val (customerId, fName, lName, verified, dob) = customers.columns @@ -970,7 +967,7 @@ object SqlServerModuleSpec extends SqlServerRunnableSpec { implicit val orderSchema = DeriveSchema.gen[Orders] - val orders = defineTable[Orders] + val orders = Table.defineTable[Orders] val (orderId, fkCustomerId, orderDate) = orders.columns } @@ -980,7 +977,7 @@ object SqlServerModuleSpec extends SqlServerRunnableSpec { implicit val productPricesSchema = DeriveSchema.gen[ProductPrices] - val productPrices = defineTable[ProductPrices] + val productPrices = Table.defineTable[ProductPrices] val (fkProductId, effective, price) = productPrices.columns } @@ -990,7 +987,7 @@ object SqlServerModuleSpec extends SqlServerRunnableSpec { implicit val orderDetailsSchema = DeriveSchema.gen[OrderDetails] - val orderDetails = defineTable[OrderDetails] + val orderDetails = Table.defineTable[OrderDetails] val (orderDetailsId, productId, quantity, unitPrice) = orderDetails.columns } @@ -1041,7 +1038,7 @@ object SqlServerModuleSpec extends SqlServerRunnableSpec { implicit val alTypesSchema = DeriveSchema.gen[AllType] - val allTypes = defineTableSmart[AllType] + val allTypes = Table.defineTableSmart[AllType] val ( id, From fb55409bf84d21915e0b4b972fb28a7e9b301c24 Mon Sep 17 00:00:00 2001 From: sviezypan Date: Thu, 16 Feb 2023 21:37:34 +0100 Subject: [PATCH 3/5] formatting and 2.12 compilation fix --- core/jvm/src/main/scala/zio/sql/Sql.scala | 4 ++-- .../scala/zio/sql/expr/ComparableTypes.scala | 2 +- .../main/scala/zio/sql/expr/FunctionName.scala | 2 +- core/jvm/src/main/scala/zio/sql/expr/Set.scala | 2 +- .../src/main/scala/zio/sql/insert/Insert.scala | 2 +- .../scala/zio/sql/insert/InsertBuilder.scala | 2 +- .../zio/sql/insert/InsertByCommaBuilder.scala | 1 - .../src/main/scala/zio/sql/ops/Operator.scala | 2 +- .../scala/zio/sql/select/ColumnSelection.scala | 3 +-- .../scala/zio/sql/select/DecodingError.scala | 4 ++-- .../main/scala/zio/sql/select/Ordering.scala | 2 +- .../main/scala/zio/sql/select/SelectAll.scala | 10 ++++++---- .../scala/zio/sql/select/SubselectBuilder.scala | 2 +- .../zio/sql/table/ExprAccesorBuilder.scala | 4 ++-- .../main/scala/zio/sql/typetag/Decodable.scala | 2 +- .../main/scala/zio/sql/typetag/IsIntegral.scala | 2 +- .../main/scala/zio/sql/typetag/IsNumeric.scala | 2 +- .../main/scala/zio/sql/typetag/TypeTag.scala | 10 ++-------- .../src/main/scala/zio/sql/update/Update.scala | 2 +- .../scala/zio/sql/update/UpdateBuilder.scala | 2 +- .../zio/sql/utils/TrailingUnitNormalizer.scala | 17 ++++++++--------- .../src/test/scala/zio/sql/ProductSchema.scala | 2 +- .../scala/zio/sql/TestBasicSelectSpec.scala | 2 +- .../scala/zio/sql/mysql/MysqlRenderModule.scala | 8 ++++---- .../scala/zio/sql/mysql/MysqlSqlModule.scala | 4 ++-- .../zio/sql/oracle/OracleRenderModule.scala | 4 ++-- .../scala/zio/sql/oracle/OracleSqlModule.scala | 4 ++-- .../sql/postgresql/PostgresRenderModule.scala | 12 ++++++------ .../zio/sql/postgresql/PostgresSqlModule.scala | 4 ++-- .../zio/sql/postgresql/AgregationSpec.scala | 2 +- .../sql/sqlserver/SqlServerRenderModule.scala | 4 ++-- 31 files changed, 59 insertions(+), 66 deletions(-) diff --git a/core/jvm/src/main/scala/zio/sql/Sql.scala b/core/jvm/src/main/scala/zio/sql/Sql.scala index 38beb29ba..a55e4649a 100644 --- a/core/jvm/src/main/scala/zio/sql/Sql.scala +++ b/core/jvm/src/main/scala/zio/sql/Sql.scala @@ -52,7 +52,7 @@ trait Sql { def renderInsert[A: Schema](insert: Insert[_, A]): String - //TODO don't know where to put it now + // TODO don't know where to put it now implicit def convertOptionToSome[A](implicit op: Schema[Option[A]]): Schema[Some[A]] = op.transformOrFail[Some[A]]( { @@ -61,5 +61,5 @@ trait Sql { }, someA => Right(someA) ) - implicit val none: Schema[None.type] = Schema.singleton(None) + implicit val none: Schema[None.type] = Schema.singleton(None) } diff --git a/core/jvm/src/main/scala/zio/sql/expr/ComparableTypes.scala b/core/jvm/src/main/scala/zio/sql/expr/ComparableTypes.scala index 2812ac452..8224ae183 100644 --- a/core/jvm/src/main/scala/zio/sql/expr/ComparableTypes.scala +++ b/core/jvm/src/main/scala/zio/sql/expr/ComparableTypes.scala @@ -36,4 +36,4 @@ object ComparableTypes extends ComparableTypesLowPriority { sealed trait ComparableTypesLowPriority { implicit final def comparableSubtype2[A, B <: A]: ComparableTypes[A, B] = new ComparableTypes[A, B] {} -} \ No newline at end of file +} diff --git a/core/jvm/src/main/scala/zio/sql/expr/FunctionName.scala b/core/jvm/src/main/scala/zio/sql/expr/FunctionName.scala index d72d40043..7a4b00b4f 100644 --- a/core/jvm/src/main/scala/zio/sql/expr/FunctionName.scala +++ b/core/jvm/src/main/scala/zio/sql/expr/FunctionName.scala @@ -1,3 +1,3 @@ package zio.sql.expr -final case class FunctionName(name: String) \ No newline at end of file +final case class FunctionName(name: String) diff --git a/core/jvm/src/main/scala/zio/sql/expr/Set.scala b/core/jvm/src/main/scala/zio/sql/expr/Set.scala index fb951857f..cee01b5d9 100644 --- a/core/jvm/src/main/scala/zio/sql/expr/Set.scala +++ b/core/jvm/src/main/scala/zio/sql/expr/Set.scala @@ -30,4 +30,4 @@ object Set { def typeTag = implicitly[TypeTag[Value]] } -} \ No newline at end of file +} diff --git a/core/jvm/src/main/scala/zio/sql/insert/Insert.scala b/core/jvm/src/main/scala/zio/sql/insert/Insert.scala index 7e9f7f640..16ba7fc4c 100644 --- a/core/jvm/src/main/scala/zio/sql/insert/Insert.scala +++ b/core/jvm/src/main/scala/zio/sql/insert/Insert.scala @@ -6,4 +6,4 @@ import zio.sql.select._ final case class Insert[A, Z](table: Table.Source.Aux[A], sources: SelectionSet[A], values: Seq[Z])(implicit schemaN: Schema[Z] -) \ No newline at end of file +) diff --git a/core/jvm/src/main/scala/zio/sql/insert/InsertBuilder.scala b/core/jvm/src/main/scala/zio/sql/insert/InsertBuilder.scala index 331e7d068..bba6015a9 100644 --- a/core/jvm/src/main/scala/zio/sql/insert/InsertBuilder.scala +++ b/core/jvm/src/main/scala/zio/sql/insert/InsertBuilder.scala @@ -19,4 +19,4 @@ final case class InsertBuilder[F, Source, AllColumnIdentities, B <: SelectionSet schemaCC: Schema[Z], schemaValidity: InsertLike[F, ColsRepr, AllColumnIdentities, Z] ): Insert[Source, Z] = Insert(table, sources.value, Seq(value)) -} \ No newline at end of file +} diff --git a/core/jvm/src/main/scala/zio/sql/insert/InsertByCommaBuilder.scala b/core/jvm/src/main/scala/zio/sql/insert/InsertByCommaBuilder.scala index 051cfe6be..cd3ffbaa3 100644 --- a/core/jvm/src/main/scala/zio/sql/insert/InsertByCommaBuilder.scala +++ b/core/jvm/src/main/scala/zio/sql/insert/InsertByCommaBuilder.scala @@ -3,7 +3,6 @@ package zio.sql.insert import zio.sql.table._ import zio.sql.expr.Expr import zio.sql.select._ -import zio.sql.insert.InsertBuilder // format: off final case class InsertByCommaBuilder[Source, AllColumnIdentities]( diff --git a/core/jvm/src/main/scala/zio/sql/ops/Operator.scala b/core/jvm/src/main/scala/zio/sql/ops/Operator.scala index 9744cf0a9..50cdd0031 100644 --- a/core/jvm/src/main/scala/zio/sql/ops/Operator.scala +++ b/core/jvm/src/main/scala/zio/sql/ops/Operator.scala @@ -37,7 +37,7 @@ object Operator { override val symbol: String = "/" } - case object AndBool extends BinaryOp[Boolean] { + case object AndBool extends BinaryOp[Boolean] { override val symbol: String = "and" } diff --git a/core/jvm/src/main/scala/zio/sql/select/ColumnSelection.scala b/core/jvm/src/main/scala/zio/sql/select/ColumnSelection.scala index b6431cdbc..c75cf7d4a 100644 --- a/core/jvm/src/main/scala/zio/sql/select/ColumnSelection.scala +++ b/core/jvm/src/main/scala/zio/sql/select/ColumnSelection.scala @@ -12,7 +12,6 @@ sealed trait ColumnSelection[-Source, +ColumnType] { val toColumn: Column[ColumnType] } - object ColumnSelection { final case class Constant[ColumnType: TypeTag](value: ColumnType, name: Option[String]) extends ColumnSelection[Any, ColumnType] { @@ -33,4 +32,4 @@ object ColumnSelection { case None => Column.Indexed() } } -} \ No newline at end of file +} diff --git a/core/jvm/src/main/scala/zio/sql/select/DecodingError.scala b/core/jvm/src/main/scala/zio/sql/select/DecodingError.scala index 4585547ac..7fa51cb2a 100644 --- a/core/jvm/src/main/scala/zio/sql/select/DecodingError.scala +++ b/core/jvm/src/main/scala/zio/sql/select/DecodingError.scala @@ -16,7 +16,7 @@ object DecodingError { final case class MissingColumn(column: Int) extends DecodingError { def message = s"The column with index ${column} does not exist" } - case object Closed extends DecodingError { + case object Closed extends DecodingError { def message = s"The ResultSet has been closed, so decoding is impossible" } -} \ No newline at end of file +} diff --git a/core/jvm/src/main/scala/zio/sql/select/Ordering.scala b/core/jvm/src/main/scala/zio/sql/select/Ordering.scala index 5291f6e67..5b84fb728 100644 --- a/core/jvm/src/main/scala/zio/sql/select/Ordering.scala +++ b/core/jvm/src/main/scala/zio/sql/select/Ordering.scala @@ -13,4 +13,4 @@ object Ordering { implicit def exprToOrdering[F, A, B](expr: Expr[F, A, B]): Ordering[Expr[F, A, B]] = Asc(expr) -} \ No newline at end of file +} diff --git a/core/jvm/src/main/scala/zio/sql/select/SelectAll.scala b/core/jvm/src/main/scala/zio/sql/select/SelectAll.scala index 449fb7aea..0b3b6e13b 100644 --- a/core/jvm/src/main/scala/zio/sql/select/SelectAll.scala +++ b/core/jvm/src/main/scala/zio/sql/select/SelectAll.scala @@ -4,7 +4,7 @@ import zio.sql.table._ final case class SelectAll() { - //TODO check if helper's types can be moved to table or rewrite to macro + // TODO check if helper's types can be moved to table or rewrite to macro def from[A](table: Table.Source.Aux[A])(implicit helper: SelectAllHelper[table.ColumnsOut, A]): Read.Select[ helper.F, helper.ResultTypeRepr, @@ -18,10 +18,12 @@ final case class SelectAll() { helper.ColumnHead, helper.SelectionTail ] - val b: B0 = ??? //table.all.selection.value.asInstanceOf[B0] + val b: B0 = ??? // table.all.selection.value.asInstanceOf[B0] Read.Subselect[helper.F, helper.ResultTypeRepr, A, A, helper.ColumnHead, helper.SelectionTail]( - Selection[helper.F, A, B0](b), Some(table), true + Selection[helper.F, A, B0](b), + Some(table), + true ) } -} \ No newline at end of file +} diff --git a/core/jvm/src/main/scala/zio/sql/select/SubselectBuilder.scala b/core/jvm/src/main/scala/zio/sql/select/SubselectBuilder.scala index 10b513c37..a627a569a 100644 --- a/core/jvm/src/main/scala/zio/sql/select/SubselectBuilder.scala +++ b/core/jvm/src/main/scala/zio/sql/select/SubselectBuilder.scala @@ -28,4 +28,4 @@ final case class SubselectBuilder[F, Source, B <: SelectionSet[Source], ParentTa Read.Subselect(Selection[F, Source with ParentTable, B0](b), Some(table), true).normalize } -} \ No newline at end of file +} diff --git a/core/jvm/src/main/scala/zio/sql/table/ExprAccesorBuilder.scala b/core/jvm/src/main/scala/zio/sql/table/ExprAccesorBuilder.scala index c9456b8d1..f5a5b013f 100644 --- a/core/jvm/src/main/scala/zio/sql/table/ExprAccesorBuilder.scala +++ b/core/jvm/src/main/scala/zio/sql/table/ExprAccesorBuilder.scala @@ -1,6 +1,6 @@ package zio.sql.table -import zio.sql._ +import zio.sql._ import zio.schema._ import zio.sql.typetag._ @@ -26,4 +26,4 @@ class ExprAccessorBuilder(name: String) extends AccessorBuilder { def makeTraversal[S, A](collection: Schema.Collection[S, A], element: Schema[A]): Traversal[S, A] = () -} \ No newline at end of file +} diff --git a/core/jvm/src/main/scala/zio/sql/typetag/Decodable.scala b/core/jvm/src/main/scala/zio/sql/typetag/Decodable.scala index b7a593088..e406df463 100644 --- a/core/jvm/src/main/scala/zio/sql/typetag/Decodable.scala +++ b/core/jvm/src/main/scala/zio/sql/typetag/Decodable.scala @@ -5,4 +5,4 @@ import zio.sql.select.DecodingError trait Decodable[+A] { def decode(column: Int, resultSet: ResultSet): Either[DecodingError, A] -} \ No newline at end of file +} diff --git a/core/jvm/src/main/scala/zio/sql/typetag/IsIntegral.scala b/core/jvm/src/main/scala/zio/sql/typetag/IsIntegral.scala index ec251be6c..d0f1dd5d8 100644 --- a/core/jvm/src/main/scala/zio/sql/typetag/IsIntegral.scala +++ b/core/jvm/src/main/scala/zio/sql/typetag/IsIntegral.scala @@ -13,4 +13,4 @@ object IsIntegral { implicit case object TShortIsIntegral extends AbstractIsIntegral[Short] implicit case object TIntIsIntegral extends AbstractIsIntegral[Int] implicit case object TLongIsIntegral extends AbstractIsIntegral[Long] -} \ No newline at end of file +} diff --git a/core/jvm/src/main/scala/zio/sql/typetag/IsNumeric.scala b/core/jvm/src/main/scala/zio/sql/typetag/IsNumeric.scala index 8333f20a1..f1f9d4a0d 100644 --- a/core/jvm/src/main/scala/zio/sql/typetag/IsNumeric.scala +++ b/core/jvm/src/main/scala/zio/sql/typetag/IsNumeric.scala @@ -16,4 +16,4 @@ object IsNumeric { implicit case object TDoubleIsNumeric extends AbstractIsNumeric[Double] // TODO IS BigDecimal numeric? can I work in sql with -, + on `money` type? implicit case object TBigDecimalIsNumeric extends AbstractIsNumeric[java.math.BigDecimal] -} \ No newline at end of file +} diff --git a/core/jvm/src/main/scala/zio/sql/typetag/TypeTag.scala b/core/jvm/src/main/scala/zio/sql/typetag/TypeTag.scala index 6c812a881..7115cb9fb 100644 --- a/core/jvm/src/main/scala/zio/sql/typetag/TypeTag.scala +++ b/core/jvm/src/main/scala/zio/sql/typetag/TypeTag.scala @@ -4,7 +4,6 @@ import java.time._ import java.util.UUID import zio.Chunk import zio.schema._ -import zio.sql.typetag.Decodable trait Tag[+A] { private[zio] def cast(a: Any): A = a.asInstanceOf[A] @@ -13,7 +12,7 @@ trait Tag[+A] { sealed trait TypeTag[+A] extends Tag[A] object TypeTag { - + trait TypeTagExtension[+A] extends Tag[A] with Decodable[A] sealed trait NotNull[+A] extends TypeTag[A] @@ -42,7 +41,7 @@ object TypeTag { final case class Nullable[A: NotNull]() extends TypeTag[Option[A]] { def typeTag: TypeTag[A] = implicitly[TypeTag[A]] } - implicit case object TNone extends TypeTag[None.type] + implicit case object TNone extends TypeTag[None.type] implicit def option[A: NotNull]: TypeTag[Option[A]] = Nullable[A]() @@ -110,8 +109,3 @@ object TypeTag { case _ => None } } - - - - - diff --git a/core/jvm/src/main/scala/zio/sql/update/Update.scala b/core/jvm/src/main/scala/zio/sql/update/Update.scala index 810c8146b..379d56a89 100644 --- a/core/jvm/src/main/scala/zio/sql/update/Update.scala +++ b/core/jvm/src/main/scala/zio/sql/update/Update.scala @@ -4,7 +4,7 @@ import zio.sql.table._ import zio.sql.typetag._ import zio.sql.Features -import zio.sql.expr.{Expr, Set} +import zio.sql.expr.{ Expr, Set } // UPDATE table // SET foo = bar diff --git a/core/jvm/src/main/scala/zio/sql/update/UpdateBuilder.scala b/core/jvm/src/main/scala/zio/sql/update/UpdateBuilder.scala index 6c01b8938..c6ff804a8 100644 --- a/core/jvm/src/main/scala/zio/sql/update/UpdateBuilder.scala +++ b/core/jvm/src/main/scala/zio/sql/update/UpdateBuilder.scala @@ -8,4 +8,4 @@ import zio.sql.expr._ final case class UpdateBuilder[A](table: Table.Aux[A]) { def set[F: Features.IsSource, Value: TypeTag](lhs: Expr[F, A, Value], rhs: Expr[_, A, Value]): Update[A] = Update(table, Set(lhs, rhs) :: Nil, true) -} \ No newline at end of file +} diff --git a/core/jvm/src/main/scala/zio/sql/utils/TrailingUnitNormalizer.scala b/core/jvm/src/main/scala/zio/sql/utils/TrailingUnitNormalizer.scala index 06ffc23c2..2de8d78a0 100644 --- a/core/jvm/src/main/scala/zio/sql/utils/TrailingUnitNormalizer.scala +++ b/core/jvm/src/main/scala/zio/sql/utils/TrailingUnitNormalizer.scala @@ -1,16 +1,15 @@ package zio.sql.utils +sealed trait TrailingUnitNormalizer[In] { + type Out - sealed trait TrailingUnitNormalizer[In] { - type Out + def apply(in: In): Out +} - def apply(in: In): Out +object TrailingUnitNormalizer { + type WithOut[In0, Out0] = TrailingUnitNormalizer[In0] { + type Out = Out0 } - - object TrailingUnitNormalizer { - type WithOut[In0, Out0] = TrailingUnitNormalizer[In0] { - type Out = Out0 - } // format: off implicit def arity1[In, A]: TrailingUnitNormalizer.WithOut[(A, Unit), A] = new TrailingUnitNormalizer[(A, Unit)] { override type Out = A @@ -165,4 +164,4 @@ package zio.sql.utils (in._1, in._2._1, in._2._2._1, in._2._2._2._1, in._2._2._2._2._1, in._2._2._2._2._2._1, in._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._1, in._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._2._1) } // format: on - } \ No newline at end of file +} diff --git a/core/jvm/src/test/scala/zio/sql/ProductSchema.scala b/core/jvm/src/test/scala/zio/sql/ProductSchema.scala index 57e2e4c8d..dddf1283c 100644 --- a/core/jvm/src/test/scala/zio/sql/ProductSchema.scala +++ b/core/jvm/src/test/scala/zio/sql/ProductSchema.scala @@ -8,7 +8,7 @@ import zio.sql.table._ import zio.sql.insert._ import zio.sql.select._ import zio.sql.update._ -import zio.sql.delete._ +import zio.sql.delete._ object ProductSchema { val sql = new Sql { self => diff --git a/core/jvm/src/test/scala/zio/sql/TestBasicSelectSpec.scala b/core/jvm/src/test/scala/zio/sql/TestBasicSelectSpec.scala index cc92eb9d8..8723b53b7 100644 --- a/core/jvm/src/test/scala/zio/sql/TestBasicSelectSpec.scala +++ b/core/jvm/src/test/scala/zio/sql/TestBasicSelectSpec.scala @@ -10,7 +10,7 @@ import zio.sql.table._ import zio.sql.select._ import zio.sql.insert._ import zio.sql.update._ -import zio.sql.delete._ +import zio.sql.delete._ object TestBasicSelect { val userSql = new Sql { self => diff --git a/mysql/src/main/scala/zio/sql/mysql/MysqlRenderModule.scala b/mysql/src/main/scala/zio/sql/mysql/MysqlRenderModule.scala index a26eee463..e3ce7df97 100644 --- a/mysql/src/main/scala/zio/sql/mysql/MysqlRenderModule.scala +++ b/mysql/src/main/scala/zio/sql/mysql/MysqlRenderModule.scala @@ -257,7 +257,7 @@ trait MysqlRenderModule extends MysqlSqlModule { self => table match { case Table.DialectSpecificTable(_) => ??? // The outer reference in this type test cannot be checked at run time?! - case sourceTable: Table.Source => + case sourceTable: Table.Source => render(sourceTable.name) case Table.DerivedTable(read, name) => render(" ( ") @@ -288,7 +288,7 @@ trait MysqlRenderModule extends MysqlSqlModule { self => case Expr.Source(table, column) => (table, column.name) match { case (tableName: String, Some(columnName)) => render(tableName, ".", columnName) - case _ => () + case _ => () } case Expr.Unary(base, op) => render(" ", op.symbol) @@ -415,9 +415,9 @@ trait MysqlRenderModule extends MysqlSqlModule { self => lit.typeTag match { case TDialectSpecific(tt) => tt match { - case tt @ TYear => + case tt @ TYear => render(tt.cast(lit.value)) - case _ => ??? + case _ => ??? } case TByteArray => render( diff --git a/mysql/src/main/scala/zio/sql/mysql/MysqlSqlModule.scala b/mysql/src/main/scala/zio/sql/mysql/MysqlSqlModule.scala index a8b7dd466..6b116f2ce 100644 --- a/mysql/src/main/scala/zio/sql/mysql/MysqlSqlModule.scala +++ b/mysql/src/main/scala/zio/sql/mysql/MysqlSqlModule.scala @@ -4,8 +4,8 @@ import java.time._ import java.sql.ResultSet import java.util.UUID import zio.sql.Sql -import zio.sql.select._ -import zio.sql.expr._ +import zio.sql.select._ +import zio.sql.expr._ import zio.sql.typetag._ trait MysqlSqlModule extends Sql { self => diff --git a/oracle/src/main/scala/zio/sql/oracle/OracleRenderModule.scala b/oracle/src/main/scala/zio/sql/oracle/OracleRenderModule.scala index 279628906..210abef2c 100644 --- a/oracle/src/main/scala/zio/sql/oracle/OracleRenderModule.scala +++ b/oracle/src/main/scala/zio/sql/oracle/OracleRenderModule.scala @@ -163,7 +163,7 @@ trait OracleRenderModule extends OracleSqlModule { self => (table, column.name) match { case (tableName: String, Some(columnName)) => val _ = builder.append(tableName).append(".").append(columnName) - case _ => () + case _ => () } case Expr.Unary(base, op) => val _ = builder.append(" ").append(op.symbol) @@ -656,7 +656,7 @@ trait OracleRenderModule extends OracleSqlModule { self => table match { case Table.DialectSpecificTable(_) => ??? // The outer reference in this type test cannot be checked at run time?! - case sourceTable: Table.Source => + case sourceTable: Table.Source => val _ = builder.append(sourceTable.name) case Table.DerivedTable(read, name) => builder.append(" ( ") diff --git a/oracle/src/main/scala/zio/sql/oracle/OracleSqlModule.scala b/oracle/src/main/scala/zio/sql/oracle/OracleSqlModule.scala index de022e416..0549167e2 100644 --- a/oracle/src/main/scala/zio/sql/oracle/OracleSqlModule.scala +++ b/oracle/src/main/scala/zio/sql/oracle/OracleSqlModule.scala @@ -5,8 +5,8 @@ import java.time.YearMonth import java.sql.ResultSet import scala.util.Try import java.time.Duration -import zio.sql.select._ -import zio.sql.expr._ +import zio.sql.select._ +import zio.sql.expr._ import zio.sql.typetag._ trait OracleSqlModule extends Sql { self => diff --git a/postgres/src/main/scala/zio/sql/postgresql/PostgresRenderModule.scala b/postgres/src/main/scala/zio/sql/postgresql/PostgresRenderModule.scala index 63545a098..86f0cab21 100644 --- a/postgres/src/main/scala/zio/sql/postgresql/PostgresRenderModule.scala +++ b/postgres/src/main/scala/zio/sql/postgresql/PostgresRenderModule.scala @@ -218,9 +218,9 @@ trait PostgresRenderModule extends PostgresSqlModule { self => case TString => render("'", value, "'") case TDialectSpecific(typeTagExtension) => typeTagExtension match { - case tt @ TInterval => render(tt.cast(value)) - case tt @ TTimestampz => render(tt.cast(value)) - case _ => ??? + case tt @ TInterval => render(tt.cast(value)) + case tt @ TTimestampz => render(tt.cast(value)) + case _ => ??? } case TByteArray => render( @@ -265,7 +265,7 @@ trait PostgresRenderModule extends PostgresSqlModule { self => (table, column.name) match { case (tableName: String, Some(columnName)) => render(quoted(tableName), ".", quoted(columnName)) - case _ => () + case _ => () } e.typeTag match { case TypeTag.TBigDecimal => render("::numeric") @@ -530,10 +530,10 @@ trait PostgresRenderModule extends PostgresSqlModule { self => render(" ,lateral ") renderTable(derivedTable) - case _ => ??? + case _ => ??? } // The outer reference in this type test cannot be checked at run time?! - case sourceTable: Table.Source => render(quoted(sourceTable.name)) + case sourceTable: Table.Source => render(quoted(sourceTable.name)) case Table.DerivedTable(read, name) => render(" ( ") render(renderRead(read.asInstanceOf[Read[_]])) diff --git a/postgres/src/main/scala/zio/sql/postgresql/PostgresSqlModule.scala b/postgres/src/main/scala/zio/sql/postgresql/PostgresSqlModule.scala index cafc58215..8010b1f72 100644 --- a/postgres/src/main/scala/zio/sql/postgresql/PostgresSqlModule.scala +++ b/postgres/src/main/scala/zio/sql/postgresql/PostgresSqlModule.scala @@ -46,7 +46,7 @@ trait PostgresSqlModule extends Sql { self => } } - //could not find implicit value for evidence parameter of type + // could not find implicit value for evidence parameter of type // zio.sql.typetag.TypeTag[zio.sql.postgresql.CustomFunctionDefSpec.PostgresSpecific.Interval] trait PostgresTypeTag[+A] extends TypeTagExtension[A] @@ -60,7 +60,7 @@ trait PostgresSqlModule extends Sql { self => _ => Right(()) ) } - implicit case object TInterval extends TypeTagExtension[Interval] { + implicit case object TInterval extends TypeTagExtension[Interval] { override def decode( column: Int, resultSet: ResultSet diff --git a/postgres/src/test/scala/zio/sql/postgresql/AgregationSpec.scala b/postgres/src/test/scala/zio/sql/postgresql/AgregationSpec.scala index 6fdb26253..09fda085a 100644 --- a/postgres/src/test/scala/zio/sql/postgresql/AgregationSpec.scala +++ b/postgres/src/test/scala/zio/sql/postgresql/AgregationSpec.scala @@ -13,7 +13,7 @@ object AgregationSpec extends PostgresRunnableSpec with DbSchema { override def specLayered = suite("Postgres module with aggregate function SumInt, SumDec and avgDec ")( test("Can aggregate colums SumInt(Int column) and SumDec(BigDdecimal colum)") { - + val query = select((SumDec(unitPrice) as "totalAmount"), (SumInt(quantity) as "soldQuantity")) .from(orderDetails) .where(orderDetailsProductId === UUID.fromString("7368ABF4-AED2-421F-B426-1725DE756895")) diff --git a/sqlserver/src/main/scala/zio/sql/sqlserver/SqlServerRenderModule.scala b/sqlserver/src/main/scala/zio/sql/sqlserver/SqlServerRenderModule.scala index 63f24f44f..900b2d510 100644 --- a/sqlserver/src/main/scala/zio/sql/sqlserver/SqlServerRenderModule.scala +++ b/sqlserver/src/main/scala/zio/sql/sqlserver/SqlServerRenderModule.scala @@ -166,7 +166,7 @@ trait SqlServerRenderModule extends SqlServerSqlModule { self => (table, column.name) match { case (tableName: String, Some(columnName)) => render(tableName, ".", columnName) - case _ => () + case _ => () } case Expr.Unary(base, op) => render(" ", op.symbol) @@ -387,7 +387,7 @@ trait SqlServerRenderModule extends SqlServerSqlModule { self => } val _ = buildTable(derivedTable) - case _ => ??? + case _ => ??? } case Table.Joined(joinType, left, right, on) => From 6878b32a806bea5ec0d8f7cb6a2e9218ff949627 Mon Sep 17 00:00:00 2001 From: sviezypan Date: Thu, 16 Feb 2023 21:53:51 +0100 Subject: [PATCH 4/5] generated readme --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 587fd496e..1cd35cfa2 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ZIO SQL lets you write type-safe, type-inferred, and composable SQL queries in ordinary Scala, helping you prevent persistence bugs before they happen, and leverage your IDE to make writing SQL productive, safe, and fun. -[![Production Ready](https://img.shields.io/badge/Project%20Stage-Production%20Ready-brightgreen.svg)](https://github.com/zio/zio/wiki/Project-Stages) ![CI Badge](https://github.com/zio/zio-sql/workflows/CI/badge.svg) [![Sonatype Releases](https://img.shields.io/nexus/r/https/oss.sonatype.org/dev.zio/zio-sql_2.13.svg?label=Sonatype%20Release)](https://oss.sonatype.org/content/repositories/releases/dev/zio/zio-sql_2.13/) [![Sonatype Snapshots](https://img.shields.io/nexus/s/https/oss.sonatype.org/dev.zio/zio-sql_2.13.svg?label=Sonatype%20Snapshot)](https://oss.sonatype.org/content/repositories/snapshots/dev/zio/zio-sql_2.13/) [![javadoc](https://javadoc.io/badge2/dev.zio/zio-sql-docs_2.13/javadoc.svg)](https://javadoc.io/doc/dev.zio/zio-sql-docs_2.13) [![ZIO SQL](https://img.shields.io/github/stars/zio/zio-sql?style=social)](https://github.com/zio/zio-sql) +[![Production Ready](https://img.shields.io/badge/Project%20Stage-Production%20Ready-brightgreen.svg)](https://github.com/zio/zio/wiki/Project-Stages) ![CI Badge](https://github.com/zio/zio-sql/workflows/CI/badge.svg) [![Sonatype Snapshots](https://img.shields.io/nexus/s/https/oss.sonatype.org/dev.zio/zio-sql_2.13.svg?label=Sonatype%20Snapshot)](https://oss.sonatype.org/content/repositories/snapshots/dev/zio/zio-sql_2.13/) [![ZIO SQL](https://img.shields.io/github/stars/zio/zio-sql?style=social)](https://github.com/zio/zio-sql) ## Introduction @@ -63,16 +63,16 @@ ZIO SQL is packaged into separate modules for different databases. Depending on ```scala //PostgreSQL -libraryDependencies += "dev.zio" %% "zio-sql-postgres" % "0.1.1" +libraryDependencies += "dev.zio" %% "zio-sql-postgres" % "" //MySQL -libraryDependencies += "dev.zio" %% "zio-sql-mysql" % "0.1.1" +libraryDependencies += "dev.zio" %% "zio-sql-mysql" % "" //Oracle -libraryDependencies += "dev.zio" %% "zio-sql-oracle" % "0.1.1" +libraryDependencies += "dev.zio" %% "zio-sql-oracle" % "" //SQL Server -libraryDependencies += "dev.zio" %% "zio-sql-sqlserver" % "0.1.1" +libraryDependencies += "dev.zio" %% "zio-sql-sqlserver" % "" ``` ## Imports and modules From 21cd32c5b6ed02324374978b11e96db4e2b85776 Mon Sep 17 00:00:00 2001 From: sviezypan Date: Mon, 20 Feb 2023 16:32:07 +0100 Subject: [PATCH 5/5] fix not implemented error --- core/jvm/src/main/scala/zio/sql/select/SelectAll.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/jvm/src/main/scala/zio/sql/select/SelectAll.scala b/core/jvm/src/main/scala/zio/sql/select/SelectAll.scala index 0b3b6e13b..8a9d9e3e5 100644 --- a/core/jvm/src/main/scala/zio/sql/select/SelectAll.scala +++ b/core/jvm/src/main/scala/zio/sql/select/SelectAll.scala @@ -18,7 +18,7 @@ final case class SelectAll() { helper.ColumnHead, helper.SelectionTail ] - val b: B0 = ??? // table.all.selection.value.asInstanceOf[B0] + val b: B0 = table.all.selection.value.asInstanceOf[B0] Read.Subselect[helper.F, helper.ResultTypeRepr, A, A, helper.ColumnHead, helper.SelectionTail]( Selection[helper.F, A, B0](b),