MCPcopy Create free account
hub / github.com/effect-app/libs / relation

Function relation

packages/effect-app/src/Model/query/dsl.ts:582–806  ·  view source on GitHub ↗
(
  path: P
)

Source from the content-addressed store, hash-verified

580 * persistence-model (PM) reverse-mapping is needed:
581 *
582 * - `"transform"` (default when `mode` omitted): goes through the repo's
583 * `parseMany` pipeline. The raw row is reverse-mapped via the
584 * etag/PM cache (re-injecting `_etag` and any PM-shape state) before
585 * decoding. Decode failures `orDie` (error channel = `never`). Use when
586 * the schema operates on the full PM shape (e.g. full-entity reads that
587 * must preserve etag tracking).
588 *
589 * - `"project"`: decodes the raw encoded row directly with the supplied
590 * schema. No PM reverse-mapping, no etag cache merge. Decode failures
591 * surface as `S.SchemaError`. Use for slim DTOs / aggregations that do not
592 * need etag tracking and whose schema input is a plain subset of `Encoded`.
593 *
594 * - `"collect"`: like `"project"`, but the schema yields `Option<A>` and
595 * `None` values are dropped post-decode (`Array.getSomes`). Use to filter
596 * rows during decode (e.g. discriminated-union narrowing where some rows
597 * should not appear in the result).
598 */
599export const project: {
600 <
601 Q extends Query<any> | QueryWhere<any, any, any> | QueryEnd<any, "one" | "many", any>,
602 I extends ExtractFieldValuesRefined<Q>,
603 A = ExtractFieldValuesRefined<Q>,
604 R = never,
605 E extends boolean = ExtractExclusiveness<Q>
606 >(
607 schema: S.Codec<Option.Option<A>, I, R>,
608 mode: "collect"
609 ): (
610 current: Q
611 ) => QueryProjection<ExtractFieldValuesRefined<Q>, A, R, ExtractTType<Q>, E>
612
613 <
614 Q extends Query<any> | QueryWhere<any, any, any> | QueryEnd<any, "one" | "many", any>,
615 I extends ExtractFieldValuesRefined<Q>,
616 A = ExtractFieldValuesRefined<Q>,
617 R = never,
618 E extends boolean = ExtractExclusiveness<Q>
619 >(
620 schema: S.Codec<A, I, R>,
621 mode: "project"
622 ): (
623 current: Q
624 ) => QueryProjection<ExtractFieldValuesRefined<Q>, A, R, ExtractTType<Q>, E>
625 <
626 Q extends Query<any> | QueryWhere<any, any, any> | QueryEnd<any, "one" | "many", any>,
627 I extends ExtractFieldValuesRefined<Q>,
628 A = ExtractFieldValuesRefined<Q>,
629 R = never,
630 E extends boolean = ExtractExclusiveness<Q>
631 >(
632 schema: S.Codec<A, I, R>
633 ): (
634 current: Q
635 ) => QueryProjection<ExtractFieldValuesRefined<Q>, A, R, ExtractTType<Q>, E>
636
637 <
638 Q extends Query<any> | QueryWhere<any, any, any> | QueryEnd<any, "one" | "many", any>,
639 I extends FieldValues,

Callers 4

query.test.tsFile · 0.90
rawQuery.test.tsFile · 0.90
makeComputedHelpersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…