diff --git a/core/src/main/scala-2/no/nrk/bigquery/internal/package.scala b/core/src/main/scala-2/no/nrk/bigquery/internal/package.scala index 5c8a649c..042354b0 100644 --- a/core/src/main/scala-2/no/nrk/bigquery/internal/package.scala +++ b/core/src/main/scala-2/no/nrk/bigquery/internal/package.scala @@ -1,3 +1,9 @@ +/* + * Copyright 2020 NRK + * + * SPDX-License-Identifier: Apache-2.0 + */ + package no.nrk.bigquery package object internal { diff --git a/core/src/main/scala-3/no/nrk/bigquery/internal/Nat.scala b/core/src/main/scala-3/no/nrk/bigquery/internal/Nat.scala index 19b6e343..ecb3961e 100644 --- a/core/src/main/scala-3/no/nrk/bigquery/internal/Nat.scala +++ b/core/src/main/scala-3/no/nrk/bigquery/internal/Nat.scala @@ -1,32 +1,36 @@ -package no.nrk.bigquery.internal +/* + * Copyright 2020 NRK + * + * SPDX-License-Identifier: Apache-2.0 + */ -import scala.compiletime.ops.int.S +package no.nrk.bigquery.internal -trait Nat +sealed trait Nat object nat { - type _0 = S[0] with Nat - type _1 = S[1] with Nat - type _2 = S[2] with Nat - type _3 = S[3] with Nat - type _4 = S[4] with Nat - type _5 = S[5] with Nat - type _6 = S[6] with Nat - type _7 = S[7] with Nat - type _8 = S[8] with Nat - type _9 = S[9] with Nat - type _10 = S[10] with Nat - type _11 = S[11] with Nat - type _12 = S[12] with Nat - type _13 = S[13] with Nat - type _14 = S[14] with Nat - type _15 = S[15] with Nat - type _16 = S[16] with Nat - type _17 = S[17] with Nat - type _18 = S[18] with Nat - type _19 = S[19] with Nat - type _20 = S[20] with Nat - type _21 = S[21] with Nat - type _22 = S[22] with Nat -} \ No newline at end of file + type _0 = 0 with Nat + type _1 = 1 with Nat + type _2 = 2 with Nat + type _3 = 3 with Nat + type _4 = 4 with Nat + type _5 = 5 with Nat + type _6 = 6 with Nat + type _7 = 7 with Nat + type _8 = 8 with Nat + type _9 = 9 with Nat + type _10 = 10 with Nat + type _11 = 11 with Nat + type _12 = 12 with Nat + type _13 = 13 with Nat + type _14 = 14 with Nat + type _15 = 15 with Nat + type _16 = 16 with Nat + type _17 = 17 with Nat + type _18 = 18 with Nat + type _19 = 19 with Nat + type _20 = 20 with Nat + type _21 = 21 with Nat + type _22 = 22 with Nat +} diff --git a/core/src/main/scala-3/no/nrk/bigquery/internal/Sized.scala b/core/src/main/scala-3/no/nrk/bigquery/internal/Sized.scala index a264f187..2404b707 100644 --- a/core/src/main/scala-3/no/nrk/bigquery/internal/Sized.scala +++ b/core/src/main/scala-3/no/nrk/bigquery/internal/Sized.scala @@ -1,6 +1,12 @@ +/* + * Copyright 2020 NRK + * + * SPDX-License-Identifier: Apache-2.0 + */ + package no.nrk.bigquery.internal -final class Sized[+Repr, N <: Nat] (val unsized : Repr) { +final class Sized[+Repr, N <: Nat](val unsized: Repr) { override def toString = unsized.toString override def equals(other: Any): Boolean = @@ -12,12 +18,10 @@ final class Sized[+Repr, N <: Nat] (val unsized : Repr) { override def hashCode: Int = unsized.hashCode } - object Sized { def apply[CC[_]] = new SizedBuilder[CC] - def wrap[Repr, L <: Nat](r: Repr): Sized[Repr, L] = new Sized[Repr, L](r) diff --git a/core/src/main/scala-3/no/nrk/bigquery/internal/SizedBuilder.scala b/core/src/main/scala-3/no/nrk/bigquery/internal/SizedBuilder.scala index 3edc2d8f..2acd8927 100644 --- a/core/src/main/scala-3/no/nrk/bigquery/internal/SizedBuilder.scala +++ b/core/src/main/scala-3/no/nrk/bigquery/internal/SizedBuilder.scala @@ -1,3 +1,9 @@ +/* + * Copyright 2020 NRK + * + * SPDX-License-Identifier: Apache-2.0 + */ + package no.nrk.bigquery.internal class SizedBuilder[CC[_]] { @@ -6,22 +12,187 @@ class SizedBuilder[CC[_]] { def apply[A](a1: A, a2: A, a3: A) = new Sized[IndexedSeq[A], nat._3](IndexedSeq(a1, a2, a3)) def apply[A](a1: A, a2: A, a3: A, a4: A) = new Sized[IndexedSeq[A], nat._4](IndexedSeq(a1, a2, a3, a4)) def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A) = new Sized[IndexedSeq[A], nat._5](IndexedSeq(a1, a2, a3, a4, a5)) - def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A) = new Sized[IndexedSeq[A], nat._6](IndexedSeq(a1, a2, a3, a4, a5, a6)) - def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A) = new Sized[IndexedSeq[A], nat._7](IndexedSeq(a1, a2, a3, a4, a5, a6, a7)) - def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A) = new Sized[IndexedSeq[A], nat._8](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8)) - def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A, a9: A) = new Sized[IndexedSeq[A], nat._9](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9)) - def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A, a9: A, a10: A) = new Sized[IndexedSeq[A], nat._10](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)) - def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A, a9: A, a10: A, a11: A) = new Sized[IndexedSeq[A], nat._11](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)) - def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A, a9: A, a10: A, a11: A, a12: A) = new Sized[IndexedSeq[A], nat._12](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12)) - def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A, a9: A, a10: A, a11: A, a12: A, a13: A) = new Sized[IndexedSeq[A], nat._13](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13)) - def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A, a9: A, a10: A, a11: A, a12: A, a13: A, a14: A) = new Sized[IndexedSeq[A], nat._14](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14)) - def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A, a9: A, a10: A, a11: A, a12: A, a13: A, a14: A, a15: A) = new Sized[IndexedSeq[A], nat._15](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15)) - def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A, a9: A, a10: A, a11: A, a12: A, a13: A, a14: A, a15: A, a16: A) = new Sized[IndexedSeq[A], nat._16](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16)) - def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A, a9: A, a10: A, a11: A, a12: A, a13: A, a14: A, a15: A, a16: A, a17: A) = new Sized[IndexedSeq[A], nat._17](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17)) - def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A, a9: A, a10: A, a11: A, a12: A, a13: A, a14: A, a15: A, a16: A, a17: A, a18: A) = new Sized[IndexedSeq[A], nat._18](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18)) - def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A, a9: A, a10: A, a11: A, a12: A, a13: A, a14: A, a15: A, a16: A, a17: A, a18: A, a19: A) = new Sized[IndexedSeq[A], nat._19](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)) - def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A, a9: A, a10: A, a11: A, a12: A, a13: A, a14: A, a15: A, a16: A, a17: A, a18: A, a19: A, a20: A) = new Sized[IndexedSeq[A], nat._20](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)) - def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A, a9: A, a10: A, a11: A, a12: A, a13: A, a14: A, a15: A, a16: A, a17: A, a18: A, a19: A, a20: A, a21: A) = new Sized[IndexedSeq[A], nat._21](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21)) - def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A, a9: A, a10: A, a11: A, a12: A, a13: A, a14: A, a15: A, a16: A, a17: A, a18: A, a19: A, a20: A, a21: A, a22: A) = new Sized[IndexedSeq[A], nat._22](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22)) + def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A) = + new Sized[IndexedSeq[A], nat._6](IndexedSeq(a1, a2, a3, a4, a5, a6)) + def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A) = + new Sized[IndexedSeq[A], nat._7](IndexedSeq(a1, a2, a3, a4, a5, a6, a7)) + def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A) = + new Sized[IndexedSeq[A], nat._8](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8)) + def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A, a9: A) = + new Sized[IndexedSeq[A], nat._9](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9)) + def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A, a9: A, a10: A) = + new Sized[IndexedSeq[A], nat._10](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)) + def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A, a9: A, a10: A, a11: A) = + new Sized[IndexedSeq[A], nat._11](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)) + def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A, a9: A, a10: A, a11: A, a12: A) = + new Sized[IndexedSeq[A], nat._12](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12)) + def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A, a9: A, a10: A, a11: A, a12: A, a13: A) = + new Sized[IndexedSeq[A], nat._13](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13)) + def apply[A](a1: A, a2: A, a3: A, a4: A, a5: A, a6: A, a7: A, a8: A, a9: A, a10: A, a11: A, a12: A, a13: A, a14: A) = + new Sized[IndexedSeq[A], nat._14](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14)) + def apply[A]( + a1: A, + a2: A, + a3: A, + a4: A, + a5: A, + a6: A, + a7: A, + a8: A, + a9: A, + a10: A, + a11: A, + a12: A, + a13: A, + a14: A, + a15: A) = + new Sized[IndexedSeq[A], nat._15](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15)) + def apply[A]( + a1: A, + a2: A, + a3: A, + a4: A, + a5: A, + a6: A, + a7: A, + a8: A, + a9: A, + a10: A, + a11: A, + a12: A, + a13: A, + a14: A, + a15: A, + a16: A) = + new Sized[IndexedSeq[A], nat._16](IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16)) + def apply[A]( + a1: A, + a2: A, + a3: A, + a4: A, + a5: A, + a6: A, + a7: A, + a8: A, + a9: A, + a10: A, + a11: A, + a12: A, + a13: A, + a14: A, + a15: A, + a16: A, + a17: A) = new Sized[IndexedSeq[A], nat._17]( + IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17)) + def apply[A]( + a1: A, + a2: A, + a3: A, + a4: A, + a5: A, + a6: A, + a7: A, + a8: A, + a9: A, + a10: A, + a11: A, + a12: A, + a13: A, + a14: A, + a15: A, + a16: A, + a17: A, + a18: A) = new Sized[IndexedSeq[A], nat._18]( + IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18)) + def apply[A]( + a1: A, + a2: A, + a3: A, + a4: A, + a5: A, + a6: A, + a7: A, + a8: A, + a9: A, + a10: A, + a11: A, + a12: A, + a13: A, + a14: A, + a15: A, + a16: A, + a17: A, + a18: A, + a19: A) = new Sized[IndexedSeq[A], nat._19]( + IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)) + def apply[A]( + a1: A, + a2: A, + a3: A, + a4: A, + a5: A, + a6: A, + a7: A, + a8: A, + a9: A, + a10: A, + a11: A, + a12: A, + a13: A, + a14: A, + a15: A, + a16: A, + a17: A, + a18: A, + a19: A, + a20: A) = new Sized[IndexedSeq[A], nat._20]( + IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)) + def apply[A]( + a1: A, + a2: A, + a3: A, + a4: A, + a5: A, + a6: A, + a7: A, + a8: A, + a9: A, + a10: A, + a11: A, + a12: A, + a13: A, + a14: A, + a15: A, + a16: A, + a17: A, + a18: A, + a19: A, + a20: A, + a21: A) = new Sized[IndexedSeq[A], nat._21]( + IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21)) + def apply[A]( + a1: A, + a2: A, + a3: A, + a4: A, + a5: A, + a6: A, + a7: A, + a8: A, + a9: A, + a10: A, + a11: A, + a12: A, + a13: A, + a14: A, + a15: A, + a16: A, + a17: A, + a18: A, + a19: A, + a20: A, + a21: A, + a22: A) = new Sized[IndexedSeq[A], nat._22]( + IndexedSeq(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22)) } diff --git a/core/src/main/scala/no/nrk/bigquery/internal/BQShowSyntax.scala b/core/src/main/scala/no/nrk/bigquery/internal/BQShowSyntax.scala index bd0a14b1..a9ff8b79 100644 --- a/core/src/main/scala/no/nrk/bigquery/internal/BQShowSyntax.scala +++ b/core/src/main/scala/no/nrk/bigquery/internal/BQShowSyntax.scala @@ -17,6 +17,8 @@ trait BQShowSyntax extends UdfSyntax { implicit def bqShowInterpolator(sc: StringContext): BQShow.BQShowInterpolator = new BQShow.BQShowInterpolator(sc) implicit def bqShowOps[A](a: A): BQShowOps[A] = new BQShowOps[A](a) implicit def bqFragmentsOps[S[_]: Foldable, A](values: S[A]): FragmentsOps[S, A] = new FragmentsOps(values) + implicit def bqFragmentsOpsIndexedSeq[A](values: IndexedSeq[A]): FragmentsOps[IndexedSeq, A] = new FragmentsOps( + values.toVector) implicit def bqFilledTableLocalDateOps(fill: BQFilledTable[LocalDate]): BQFilledTableLocalDateOps = new BQFilledTableLocalDateOps(fill) @@ -30,7 +32,7 @@ class BQShowOps[A](a: A) { /** A way to flatten a list of fragments. The `S` just means it works for any collection data structure */ -class FragmentsOps[S[_]: Foldable, A](private val values: S[A]) { +class FragmentsOps[+S[_]: Foldable, A](private val values: S[A]) { def mkFragment(sep: String)(implicit T: BQShow[A]): BQSqlFrag = mkFragment(BQSqlFrag(sep)) diff --git a/core/src/main/scala/no/nrk/bigquery/internal/UdfSyntax.scala b/core/src/main/scala/no/nrk/bigquery/internal/UdfSyntax.scala index eb4dae21..7c9f7725 100644 --- a/core/src/main/scala/no/nrk/bigquery/internal/UdfSyntax.scala +++ b/core/src/main/scala/no/nrk/bigquery/internal/UdfSyntax.scala @@ -1,3 +1,9 @@ +/* + * Copyright 2020 NRK + * + * SPDX-License-Identifier: Apache-2.0 + */ + package no.nrk.bigquery.internal import no.nrk.bigquery.{BQSqlFrag, UDF} diff --git a/core/src/test/scala/no/nrk/bigquery/UDFTest.scala b/core/src/test/scala/no/nrk/bigquery/UDFTest.scala index dec81649..f2f19c6d 100644 --- a/core/src/test/scala/no/nrk/bigquery/UDFTest.scala +++ b/core/src/test/scala/no/nrk/bigquery/UDFTest.scala @@ -8,7 +8,7 @@ package no.nrk.bigquery import munit.FunSuite import no.nrk.bigquery.syntax._ -import shapeless._0 +import no.nrk.bigquery.internal.nat._0 class UDFTest extends FunSuite { diff --git a/core/src/test/scala/no/nrk/bigquery/internal/UdfUpdateOperationTest.scala b/core/src/test/scala/no/nrk/bigquery/internal/UdfUpdateOperationTest.scala index 96ac3772..8b6dbf54 100644 --- a/core/src/test/scala/no/nrk/bigquery/internal/UdfUpdateOperationTest.scala +++ b/core/src/test/scala/no/nrk/bigquery/internal/UdfUpdateOperationTest.scala @@ -11,7 +11,7 @@ import munit.FunSuite import no.nrk.bigquery.UpdateOperation.{CreatePersistentUdf, Illegal, UpdatePersistentUdf} import no.nrk.bigquery._ import no.nrk.bigquery.syntax._ -import shapeless._0 +import no.nrk.bigquery.internal.nat._0 class UdfUpdateOperationTest extends FunSuite {