zio.blocks.schema.patch
Members list
Type members
Classlikes
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
Attributes
- Companion
- class
- Source
- DynamicPatch.scala
- Supertypes
- Self type
-
DynamicPatch.type
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
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
- Self type
-
Patch.type
Attributes
- Companion
- trait
- Source
- PatchMode.scala
- Supertypes
- Self type
-
PatchMode.type