AvroRecordTraversal

dev.constructive.eo.avro.AvroRecordTraversal
final class AvroRecordTraversal[A]

The org.apache.avro.generic.IndexedRecord-carried face of an AvroTraversal — reachable ONLY through AvroTraversal.record, never constructed directly. Walks the record from the root down to some array, then applies the focus update to every element of that array.

Mirrors dev.constructive.eo.circe.JsonTraversal line-for-line: a traversal is "a prism applied per-element after a prefix walk". Two call-surface tiers (via AvroOpticOps):

  • '''Default (Ior-bearing).''' modify / transform / place / transfer / getAll accumulate per-element failures into the chain. Prefix-walk failures return Ior.Left — nothing to iterate.
  • '''*Unsafe (silent).''' Drops failures; preserves the silent forgiving semantics.

Drilling (.field / .at / .fields / Dynamic selection) lives on AvroTraversal alone — drill there, then flip with .record at the end. One drilling mechanism, two carriers.

Attributes

Source
AvroRecordTraversal.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def getAll(input: IndexedRecord | Array[Byte] | String): Ior[Chain[AvroFailure], Vector[A]]

Decode the focus of every element of the focused array. Parse / prefix-walk failures return Ior.Left; per-element failures accumulate into the chain while surviving elements land in the Vector (Ior.Both).

Decode the focus of every element of the focused array. Parse / prefix-walk failures return Ior.Left; per-element failures accumulate into the chain while surviving elements land in the Vector (Ior.Both).

Attributes

Source
AvroRecordTraversal.scala
inline def getAllUnsafe(input: IndexedRecord | Array[Byte] | String): Vector[A]

Silent counterpart to getAll — refusing elements are dropped; a whole-walk failure yields Vector.empty.

Silent counterpart to getAll — refusing elements are dropped; a whole-walk failure yields Vector.empty.

Attributes

Source
AvroRecordTraversal.scala
override protected def modifyImpl(record: IndexedRecord, f: A => A): IndexedRecord

Attributes

Definition Classes
AvroOpticOps
Source
AvroRecordTraversal.scala
override protected def modifyIor(record: IndexedRecord, f: A => A): Ior[Chain[AvroFailure], IndexedRecord]

Attributes

Definition Classes
AvroOpticOps
Source
AvroRecordTraversal.scala
override protected def placeImpl(record: IndexedRecord, a: A): IndexedRecord

Attributes

Definition Classes
AvroOpticOps
Source
AvroRecordTraversal.scala
override protected def placeIor(record: IndexedRecord, a: A): Ior[Chain[AvroFailure], IndexedRecord]

Attributes

Definition Classes
AvroOpticOps
Source
AvroRecordTraversal.scala
override protected def rootSchema: Schema

The reader schema used to decode Array[Byte] and String (Avro JSON wire format) inputs. The carrier's constructor cached this off the user's AvroCodec[Root]; exposing it here lets AvroCodec.parseInputIor thread it without re-summoning.

The reader schema used to decode Array[Byte] and String (Avro JSON wire format) inputs. The carrier's constructor cached this off the user's AvroCodec[Root]; exposing it here lets AvroCodec.parseInputIor thread it without re-summoning.

Attributes

Definition Classes
AvroOpticOps
Source
AvroRecordTraversal.scala
override protected def transformImpl(record: IndexedRecord, f: IndexedRecord => IndexedRecord): IndexedRecord

Attributes

Definition Classes
AvroOpticOps
Source
AvroRecordTraversal.scala
override protected def transformIor(record: IndexedRecord, f: IndexedRecord => IndexedRecord): Ior[Chain[AvroFailure], IndexedRecord]

Attributes

Definition Classes
AvroOpticOps
Source
AvroRecordTraversal.scala

Inherited methods

def modify(f: A => A): (IndexedRecord | Array[Byte] | String) => Ior[Chain[AvroFailure], IndexedRecord]

Apply f to the focused value; returns the modified record. Failures (path miss, decode failure, type mismatch) accumulate into Chain[AvroFailure]; partial success returns Ior.Both(chain, inputRecord) (the modify-family preserves the input as the silent fallback).

Apply f to the focused value; returns the modified record. Failures (path miss, decode failure, type mismatch) accumulate into Chain[AvroFailure]; partial success returns Ior.Both(chain, inputRecord) (the modify-family preserves the input as the silent fallback).

Attributes

Inherited from:
AvroOpticOps (hidden)
Source
AvroOpticOps.scala
def modifyUnsafe(f: A => A): (IndexedRecord | Array[Byte] | String) => IndexedRecord

Silent counterpart to modify — input pass-through on any failure.

Silent counterpart to modify — input pass-through on any failure.

Attributes

Inherited from:
AvroOpticOps (hidden)
Source
AvroOpticOps.scala
def place(a: A): (IndexedRecord | Array[Byte] | String) => Ior[Chain[AvroFailure], IndexedRecord]

Replace the focused value with a. Same failure surface as modify.

Replace the focused value with a. Same failure surface as modify.

Attributes

Inherited from:
AvroOpticOps (hidden)
Source
AvroOpticOps.scala
def placeUnsafe(a: A): (IndexedRecord | Array[Byte] | String) => IndexedRecord

Silent counterpart to place.

Silent counterpart to place.

Attributes

Inherited from:
AvroOpticOps (hidden)
Source
AvroOpticOps.scala
def replace(a: A): (IndexedRecord | Array[Byte] | String) => IndexedRecord

Replace the focused value with a, rebuilding the record around it — silent tier (pair with place for Ior diagnostics).

Replace the focused value with a, rebuilding the record around it — silent tier (pair with place for Ior diagnostics).

A trait MEMBER deliberately: without it, .replace on a record-carried optic resolves to the generic Either-carrier extension, which routes through from(Right(a)) = reverseGet(a) and reconstructs the focus STANDALONE — for any drilled optic that silently destroys every sibling field. This member shadows the extension with the sibling-preserving placeImpl walk.

Attributes

Inherited from:
AvroOpticOps (hidden)
Source
AvroOpticOps.scala
def transfer[C](f: C => A): (IndexedRecord | Array[Byte] | String) => C => Ior[Chain[AvroFailure], IndexedRecord]

Lift a C => A into a focus-replacer: transfer(f)(record)(c) decodes c to A via f and writes it at the focused position. Same failure surface as modify.

Lift a C => A into a focus-replacer: transfer(f)(record)(c) decodes c to A via f and writes it at the focused position. Same failure surface as modify.

Attributes

Inherited from:
AvroOpticOps (hidden)
Source
AvroOpticOps.scala
def transferUnsafe[C](f: C => A): (IndexedRecord | Array[Byte] | String) => C => IndexedRecord

Silent counterpart to transfer.

Silent counterpart to transfer.

Attributes

Inherited from:
AvroOpticOps (hidden)
Source
AvroOpticOps.scala
def transform(f: IndexedRecord => IndexedRecord): (IndexedRecord | Array[Byte] | String) => Ior[Chain[AvroFailure], IndexedRecord]

Apply f to the raw IndexedRecord at the focused position (no decode / encode through the codec layer). Useful for carrier-aware rewrites that don't want to round-trip through the focus type.

Apply f to the raw IndexedRecord at the focused position (no decode / encode through the codec layer). Useful for carrier-aware rewrites that don't want to round-trip through the focus type.

Note: the focused cursor's value is what gets passed through — for a leaf focus that may be a primitive (Long, Utf8, …), so the user's f: IndexedRecord => IndexedRecord is a slight type misfit at non-record-typed leaves.

Attributes

Inherited from:
AvroOpticOps (hidden)
Source
AvroOpticOps.scala
def transformUnsafe(f: IndexedRecord => IndexedRecord): (IndexedRecord | Array[Byte] | String) => IndexedRecord

Silent counterpart to transform.

Silent counterpart to transform.

Attributes

Inherited from:
AvroOpticOps (hidden)
Source
AvroOpticOps.scala