@@ -27,14 +27,11 @@ object SimpleTableMacros {
27
27
)[U : ClassTag ](f : (T , Int ) => IterableOnce [U ]): IArray [U ] = {
28
28
IArray .from(t.productIterator.asInstanceOf [Iterator [T ]].zipWithIndex.flatMap(f.tupled))
29
29
}
30
- def asIArrayUnwrap [T ](t : Tuple )[U : ClassTag ](f : T => U ): IArray [U ] = {
31
- IArray .from(t.productIterator.asInstanceOf [Iterator [T ]].map(f))
32
- }
33
30
def unwrapLabels (t : Tuple , labels : IArray [String ]): IndexedSeq [String ] = {
34
- asIArrayFlatUnwrapWithIndex[BaseLabels [? , ? ]](t)((l, i) => l.fetch (labels(i))).toIndexedSeq
31
+ asIArrayFlatUnwrapWithIndex[BaseLabels [Any , Any ]](t)((l, i) => l(labels(i))).toIndexedSeq
35
32
}
36
33
def unwrapColumns (t : Tuple ): IArray [AnyRef ] = {
37
- asIArrayUnwrap [BaseColumn [? , ? ]](t)(_.value )
34
+ asIArray [BaseColumn [Any , Any ]](t)
38
35
}
39
36
def make [C ](m : Mirror .ProductOf [C ], data : IArray [AnyRef ]): C = {
40
37
class ArrayProduct extends Product {
@@ -51,10 +48,10 @@ object SimpleTableMacros {
51
48
mappers : DialectTypeMappers ,
52
49
tableRef : TableRef
53
50
): IArray [AnyRef ] = {
54
- val cols = mappers match
55
- case given DialectTypeMappers =>
56
- tableRef match
57
- case given TableRef => compiletime.summonAll[Columns ]
51
+ val cols = tableRef match
52
+ case given TableRef =>
53
+ import mappers . given
54
+ compiletime.summonAll[Columns ]
58
55
unwrapColumns(cols)
59
56
}
60
57
@@ -87,32 +84,32 @@ object SimpleTableMacros {
87
84
): BaseRowExpr [T ] = delegate
88
85
}
89
86
90
- class BaseColumn [L , T ]( val value : AnyRef )
87
+ opaque type BaseColumn [L , T ] = AnyRef
91
88
trait BaseColumnLowPrio {
92
- inline given notFound : [L <: String , T ]
93
- => (l : ValueOf [L ], mappers : DialectTypeMappers , ref : TableRef ) => BaseColumn [ L , T ] =
94
- import mappers .{ * , given }
89
+ given notFound : [L <: String , T ]
90
+ => (l : ValueOf [L ], ref : TableRef , mapper : TypeMapper [ T ])
91
+ => BaseColumn [ L , T ] =
95
92
val col = new Column [T ](
96
93
ref,
97
94
Table .columnNameOverride(ref.value)(l.value)
98
- )( using compiletime.summonInline[ TypeMapper [ T ]])
99
- BaseColumn ( col)
95
+ )
96
+ col
100
97
}
101
98
object BaseColumn extends BaseColumnLowPrio {
102
99
given foundMeta : [L <: String , T ]
103
100
=> (mappers : DialectTypeMappers , ref : TableRef , m : SimpleTable .WrappedMetadata [T ])
104
101
=> BaseColumn [L , T ] =
105
- BaseColumn ( m.metadata.metadata0.vExpr(ref, mappers).asInstanceOf [AnyRef ])
102
+ m.metadata.metadata0.vExpr(ref, mappers).asInstanceOf [AnyRef ]
106
103
}
107
104
108
- class BaseLabels [L , C ]( val fetch : String => Seq [String ])
105
+ opaque type BaseLabels [L , C ] = String => Seq [String ]
109
106
trait BaseLabelsLowPrio {
110
107
given notFound : [L <: String , C ] => BaseLabels [L , C ] =
111
- new BaseLabels (fetch = label => Seq (label) )
108
+ label => Seq (label)
112
109
}
113
110
object BaseLabels extends BaseLabelsLowPrio {
114
111
given foundMeta : [L , C ] => (m : SimpleTable .WrappedMetadata [C ]) => BaseLabels [L , C ] =
115
- new BaseLabels (fetch = _ => m.metadata.metadata0.walkLabels0() )
112
+ _ => m.metadata.metadata0.walkLabels0()
116
113
}
117
114
118
115
def setNonNull [T ](r : AtomicReference [T | Null ])(f : => T ): T = {
0 commit comments