AvroPrismMacro

dev.constructive.eo.avro.AvroPrismMacro

Macros backing the drilling sugar on AvroPrism and AvroTraversal.field(_.x), selectDynamic, .at(i), .union[Branch], .each, .fields(...). Mirror of circe.JsonPrismMacro, with two-given codec summoning (AvroEncoder + AvroDecoder) collapsed to one AvroCodec wrapper. Uses '{ this } rather than 'this (scalafix-parser limitation).

Attributes

Source
AvroPrismMacro.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def atImpl[A](parent: Expr[AvroPrism[A]], iE: Expr[Int])(using evidence$1: Type[A], q: Quotes): Expr[Any]

Macro for .at(i). Verifies A <: Iterable, extracts the element type, summons the codec, emits widenPathIndex.

Macro for .at(i). Verifies A <: Iterable, extracts the element type, summons the codec, emits widenPathIndex.

Attributes

Source
AvroPrismMacro.scala
def atTraversalImpl[A](parent: Expr[AvroTraversal[A]], iE: Expr[Int])(using evidence$1: Type[A], q: Quotes): Expr[Any]

Traversal counterpart to atImpl — extends the suffix by an array index.

Traversal counterpart to atImpl — extends the suffix by an array index.

Attributes

Source
AvroPrismMacro.scala
def eachImpl[A](parent: Expr[AvroPrism[A]])(using evidence$1: Type[A], q: Quotes): Expr[Any]

.each — emits toTraversal[B] over A's element type.

.each — emits toTraversal[B] over A's element type.

Attributes

Source
AvroPrismMacro.scala
def fieldImpl[A, B](parent: Expr[AvroPrism[A]], selector: Expr[A => B], codecB: Expr[AvroCodec[B]])(using evidence$1: Type[A], evidence$2: Type[B], q: Quotes): Expr[AvroPrism[B]]

Build a child AvroPrism[B] from a parent AvroPrism[A] via a compile-time selector (_.field) plus an in-scope AvroCodec[B].

Build a child AvroPrism[B] from a parent AvroPrism[A] via a compile-time selector (_.field) plus an in-scope AvroCodec[B].

Attributes

Source
AvroPrismMacro.scala
def fieldTraversalImpl[A, B](parent: Expr[AvroTraversal[A]], selector: Expr[A => B], codecB: Expr[AvroCodec[B]])(using evidence$1: Type[A], evidence$2: Type[B], q: Quotes): Expr[AvroTraversal[B]]

Traversal counterpart to fieldImpl — extends the suffix by a named field.

Traversal counterpart to fieldImpl — extends the suffix by a named field.

Attributes

Source
AvroPrismMacro.scala
def fieldsImpl[A](parent: Expr[AvroPrism[A]], selectorsE: Expr[Seq[A => Any]])(using evidence$1: Type[A], q: Quotes): Expr[Any]

.fields(_.a, _.b, ...) — multi-field focus. Validates arity ≥ 2, duplicate-ness, known fields, non-nested. Synthesises an NT in SELECTOR order, summons AvroCodec[NT], emits toFieldsPrism. Mirrors JsonPrismMacro.fieldsImpl.

.fields(_.a, _.b, ...) — multi-field focus. Validates arity ≥ 2, duplicate-ness, known fields, non-nested. Synthesises an NT in SELECTOR order, summons AvroCodec[NT], emits toFieldsPrism. Mirrors JsonPrismMacro.fieldsImpl.

Attributes

Source
AvroPrismMacro.scala
def fieldsTraversalImpl[A](parent: Expr[AvroTraversal[A]], selectorsE: Expr[Seq[A => Any]])(using evidence$1: Type[A], q: Quotes): Expr[Any]

Traversal counterpart to fieldsImpl.

Traversal counterpart to fieldsImpl.

Attributes

Source
AvroPrismMacro.scala
def selectFieldImpl[A](parent: Expr[AvroPrism[A]], nameE: Expr[String])(using evidence$1: Type[A], q: Quotes): Expr[Any]

Drives codecPrism[Person].name. Looks name up on A's schema, summons AvroCodec[B], emits widenPath. Returns Expr[Any] so transparent inline refines per call site.

Drives codecPrism[Person].name. Looks name up on A's schema, summons AvroCodec[B], emits widenPath. Returns Expr[Any] so transparent inline refines per call site.

Attributes

Source
AvroPrismMacro.scala
def selectFieldTraversalImpl[A](parent: Expr[AvroTraversal[A]], nameE: Expr[String])(using evidence$1: Type[A], q: Quotes): Expr[Any]

Traversal counterpart to selectFieldImpl — drives Dynamic sugar by extending the suffix.

Traversal counterpart to selectFieldImpl — drives Dynamic sugar by extending the suffix.

Attributes

Source
AvroPrismMacro.scala
def unionImpl[A, B](parent: Expr[AvroPrism[A]])(using evidence$1: Type[A], evidence$2: Type[B], q: Quotes): Expr[Any]

.union[Branch] — drill into one alternative of a union-shaped focus. Supported parent shapes: Option[T] (user writes .union[T]), sealed traits, Scala 3 enum, and Scala 3 untagged unions A | B | C (Branch must be one of the members). Branch identifier resolves at runtime off AvroCodec[Branch].schema.getFullName (robust against kindlings naming drift).

.union[Branch] — drill into one alternative of a union-shaped focus. Supported parent shapes: Option[T] (user writes .union[T]), sealed traits, Scala 3 enum, and Scala 3 untagged unions A | B | C (Branch must be one of the members). Branch identifier resolves at runtime off AvroCodec[Branch].schema.getFullName (robust against kindlings naming drift).

Attributes

Source
AvroPrismMacro.scala
def unionTraversalImpl[A, B](parent: Expr[AvroTraversal[A]])(using evidence$1: Type[A], evidence$2: Type[B], q: Quotes): Expr[Any]

Traversal counterpart to unionImpl — narrows the per-element focus to one union branch by appending a PathStep.UnionBranch to the suffix. Same validation as the prism path.

Traversal counterpart to unionImpl — narrows the per-element focus to one union branch by appending a PathStep.UnionBranch to the suffix. Same validation as the prism path.

Attributes

Source
AvroPrismMacro.scala