zio.blocks.schema.patch

Members list

Type members

Classlikes

final case class DynamicPatch(ops: Chunk[DynamicPatchOp])

An untyped patch that operates on DynamicValue. Patches are serializable and can be composed.

An untyped patch that operates on DynamicValue. Patches are serializable and can be composed.

Attributes

Companion
object
Source
DynamicPatch.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object DynamicPatch

Attributes

Companion
class
Source
DynamicPatch.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class Patch[S]

A type-safe patch that can be applied to values of type S.

A type-safe patch that can be applied to values of type S.

Patches represent a sequence of operations (set, increment, append, etc.) that transform values. Because patches use serializable operations and reflective optics for navigation, they can be serialized and applied remotely.

Patches can be composed using ++ and applied using the apply method with a PatchMode (Strict, Lenient, or Clobber) to control error handling behavior. Empty patches act as identity (no-op).

import zio.blocks.schema.patch.Patch

case class Person(name: String, age: Int)
object Person extends CompanionOptics[Person] {
 implicit val schema: Schema[Person] = Schema.derived
 val name: Lens[Person, String] = $(_.name)
 val age: Lens[Person, Int]     = $(_.age)
}

val patch1 = Patch.set(Person.name, "John")
val patch2 = Patch.increment(Person.age, 1)

val patch3 = patch1 ++ patch2

patch3(Person("Jane", 25)) // Person("John", 26)

Value parameters

dynamicPatch

The untyped patch operations

schema

The schema for type S, enabling type-safe conversion

Attributes

Companion
object
Source
Patch.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Patch

Companion object providing smart constructors for type-safe patches.

Companion object providing smart constructors for type-safe patches.

Use these methods to create patches instead of the private constructor.

Attributes

Companion
class
Source
Patch.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Patch.type
object PatchMode

Attributes

Companion
trait
Source
PatchMode.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
PatchMode.type
sealed trait PatchMode

Attributes

Companion
object
Source
PatchMode.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Clobber
object Lenient
object Strict