diff --git a/ontology-quill/src/main/scala/ru/primetalk/typed/ontology/dbquill/OntPerson.scala b/ontology-quill/src/main/scala/ru/primetalk/typed/ontology/dbquill/OntPerson.scala index b5ec24d..9cfeb93 100644 --- a/ontology-quill/src/main/scala/ru/primetalk/typed/ontology/dbquill/OntPerson.scala +++ b/ontology-quill/src/main/scala/ru/primetalk/typed/ontology/dbquill/OntPerson.scala @@ -21,6 +21,7 @@ import io.getquill.generic.DecodingType import ru.primetalk.typed.ontology.dbquill.parser.TupleConverter import ru.primetalk.typed.ontology.dbquill.parser.ontQuote import io.getquill.util.LoadConfig +import ru.primetalk.typed.ontology.simple.meta.Projector object OntPerson { given schemaBasedParser: SchemaBasedParser.type = SchemaBasedParser @@ -36,7 +37,7 @@ object OntPerson { val orders = run(orderQuery) - println(orders.map(_ ->> Order1.date)) + println(orders.map(_ π Order1.smallerSchema)) } } diff --git a/ontology-quill/src/main/scala/ru/primetalk/typed/ontology/dbquill/ontology.scala b/ontology-quill/src/main/scala/ru/primetalk/typed/ontology/dbquill/ontology.scala index 713d9f6..c6a492d 100644 --- a/ontology-quill/src/main/scala/ru/primetalk/typed/ontology/dbquill/ontology.scala +++ b/ontology-quill/src/main/scala/ru/primetalk/typed/ontology/dbquill/ontology.scala @@ -14,10 +14,15 @@ object Order1 extends TableBuilder: val date1 = date type Date = date.type type TableSchema = Id #: Date #: EmptySchema + + type SmallerSchema = Date #: EmptySchema + val smallerSchema = fields(date) + val tableSchema: TableSchema = fields(id, date) val ts = fields(id, date) type TS = ts.Type val svt = summon[SchemaValueType.Aux1[TableSchema]] + val smallerSvt = summon[SchemaValueType.Aux1[SmallerSchema]] type Row = TupleConverter[svt.Value] // type ARow = svt.Value #@ TableSchema type ARow = (*:[Int, *:[LocalDate, EmptyTuple]]) #@ TableSchema diff --git a/typed-ontology-simple-meta/src/main/scala/ru/primetalk/typed/ontology/simple/meta/AnnotatedTypes.scala b/typed-ontology-simple-meta/src/main/scala/ru/primetalk/typed/ontology/simple/meta/AnnotatedTypes.scala index a52ed84..7ed1587 100644 --- a/typed-ontology-simple-meta/src/main/scala/ru/primetalk/typed/ontology/simple/meta/AnnotatedTypes.scala +++ b/typed-ontology-simple-meta/src/main/scala/ru/primetalk/typed/ontology/simple/meta/AnnotatedTypes.scala @@ -180,15 +180,15 @@ trait ProjectorAnnotatedTypes extends RecordSchemaAnnotatedTypes: VS <: Tuple, ](using rpvt: RecordPropertyValueType[P, VP], - existingSchemaProjector: Projector[From, VFrom, S, VS], + existingSchemaProjector: Projector[From, VFrom#@From, S, VS #@ S], propertyProjector: PropertyProjector[From, VFrom, P, VP], - svtps: SchemaValueType[P #: S, VP *: VS] - ): Projector[From, VFrom, P #: S, VP *: VS] = + svtps: SchemaValueType[P #: S, (VP *: VS) #@ (P #: S)] + ): Projector[From, VFrom #@From, P #: S, (VP *: VS) #@ (P #: S)] = new: - val from: SchemaValueType[From, VFrom] = existingSchemaProjector.from - val to: SchemaValueType[P #: S, VP *: VS] = svtps - def apply(v: VFrom): VP *: VS = - (propertyProjector(v) *: existingSchemaProjector(v)) + val from: SchemaValueType[From, VFrom#@From] = existingSchemaProjector.from + val to: SchemaValueType[P #: S, (VP *: VS) #@ (P #: S)] = svtps + def apply(v: VFrom#@From): (VP *: VS) #@ (P #: S) = + (propertyProjector(v) *: existingSchemaProjector(v)).#@[(P #: S)] implicit class ValueOps[S <: RecordSchema, V](v: V)(using svtv: SchemaValueType[S, V]): type Schema = S @@ -212,6 +212,10 @@ trait ProjectorAnnotatedTypes extends RecordSchemaAnnotatedTypes: pp.apply(av) def /[VP,P <:SimplePropertyId[?, VP]](p: P)(using pp: PropertyProjector[S, V#@S, P, VP]) = pp.apply(av) + def >>[VS2, S2 <: RecordSchema](s2: S2)(using p: Projector[S, V #@ S, S2, VS2 #@ S2]) = + p(av) + inline def π[VS2, S2 <: RecordSchema](s2: S2)(using p: Projector[S, V #@ S, S2, VS2 #@ S2]) = + p(av) trait TableBuilderAnnotatedTypes: final case class TableBuilderExtensionR[S <: RecordSchema, V <: Tuple](