Record

zio.blocks.schema.DynamicValue.Record
See theRecord companion object
final case class Record(fields: Chunk[(String, DynamicValue)]) extends DynamicValue

A collection of named fields, analogous to a case class or JSON object.

Field order is preserved and significant for equality comparison. Use sortFields to normalize field ordering for order-independent comparison.

Attributes

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

Members list

Value members

Concrete methods

override def as(t: DynamicValueType): Option[t.Type]

Narrows this DynamicValue to the specified type, returning Some if the types match or None otherwise.

Narrows this DynamicValue to the specified type, returning Some if the types match or None otherwise.

Attributes

Definition Classes
Source
DynamicValue.scala
def compare(that: DynamicValue): Int

Attributes

Source
DynamicValue.scala
override def equals(that: Any): Boolean

Checks whether this instance is equal to that. This universal equality method is defined in AnyRef.

Checks whether this instance is equal to that. This universal equality method is defined in AnyRef.

Attributes

Definition Classes
Equals -> Any
Source
DynamicValue.scala
override def get(fieldName: String): DynamicValueSelection

Navigates to a field in a Record by name. Returns a DynamicValueSelection containing all matching values.

Navigates to a field in a Record by name. Returns a DynamicValueSelection containing all matching values.

Attributes

Definition Classes
Source
DynamicValue.scala
override def hashCode: Int

Calculates a hash code value for the object.

Calculates a hash code value for the object.

The default hashing algorithm is platform dependent.

Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

Attributes

Returns

the hash code value for this object.

Definition Classes
Any
Source
DynamicValue.scala
def typeIndex: Int

Returns a numeric index representing this value's type, used for ordering values of different types. The ordering is: Primitive(0) < Record(1) < Variant(2) < Sequence(3) < Map(4) < Null(5).

Returns a numeric index representing this value's type, used for ordering values of different types. The ordering is: Primitive(0) < Record(1) < Variant(2) < Sequence(3) < Map(4) < Null(5).

Attributes

Source
DynamicValue.scala
override def unwrap(t: DynamicValueType): Option[t.Unwrap]

Extracts the underlying value from this DynamicValue if it matches the specified type.

Extracts the underlying value from this DynamicValue if it matches the specified type.

Attributes

Definition Classes
Source
DynamicValue.scala

Returns the DynamicValueType of this DynamicValue.

Returns the DynamicValueType of this DynamicValue.

Attributes

Source
DynamicValue.scala

Inherited methods

final def <(that: DynamicValue): Boolean

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
final def <=(that: DynamicValue): Boolean

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
final def >(that: DynamicValue): Boolean

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
final def >=(that: DynamicValue): Boolean

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
def asPrimitive[A](pt: PrimitiveType[A]): Option[A]

Extracts a primitive value of type A if this is a Primitive with matching type.

Extracts a primitive value of type A if this is a Primitive with matching type.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
def caseName: Option[String]

Returns the case name if this is a Variant, otherwise None.

Returns the case name if this is a Variant, otherwise None.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
def caseValue: Option[DynamicValue]

Returns the case value if this is a Variant, otherwise None.

Returns the case value if this is a Variant, otherwise None.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
def check(schema: DynamicSchema): Option[SchemaError]

Validates this value against a DynamicSchema.

Validates this value against a DynamicSchema.

Value parameters

schema

The schema to validate against

Attributes

Returns

None if this value conforms to the schema, or Some(SchemaError) describing the validation failure

See also

DynamicSchema.check for the underlying validation logic

Inherited from:
DynamicValue
Source
DynamicValue.scala
def conforms(schema: DynamicSchema): Boolean

Tests whether this value conforms to a DynamicSchema.

Tests whether this value conforms to a DynamicSchema.

Value parameters

schema

The schema to validate against

Attributes

Returns

true if this value passes all validation checks, false otherwise

Inherited from:
DynamicValue
Source
DynamicValue.scala

Deletes the value at the given path. If the path doesn't exist, returns the original DynamicValue unchanged.

Deletes the value at the given path. If the path doesn't exist, returns the original DynamicValue unchanged.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Deletes the value at the given path. Returns Left with an error if the path doesn't exist.

Deletes the value at the given path. Returns Left with an error if the path doesn't exist.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Computes the difference between this DynamicValue and another, producing a zio.blocks.schema.patch.DynamicPatch that can transform this value into that.

Computes the difference between this DynamicValue and another, producing a zio.blocks.schema.patch.DynamicPatch that can transform this value into that.

The diff algorithm produces minimal patches using type-appropriate operations: numeric deltas for numbers, string edit operations for text, and structural diffs for records, sequences, and maps.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Recursively removes empty Records, Sequences, and Maps.

Recursively removes empty Records, Sequences, and Maps.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Recursively removes all Null values from containers.

Recursively removes all Null values from containers.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Recursively removes all Primitive(Unit) values from containers.

Recursively removes all Primitive(Unit) values from containers.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Returns the elements if this is a Sequence, otherwise an empty Chunk.

Returns the elements if this is a Sequence, otherwise an empty Chunk.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Returns the entries if this is a Map, otherwise an empty Chunk.

Returns the entries if this is a Map, otherwise an empty Chunk.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
def foldDown[B](z: B)(f: (DynamicOptic, DynamicValue, B) => B): B

Folds over the DynamicValue structure top-down. The function receives the current path, the DynamicValue, and the accumulator. Parent values are folded before their children.

Folds over the DynamicValue structure top-down. The function receives the current path, the DynamicValue, and the accumulator. Parent values are folded before their children.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
def foldDownOrFail[B](z: B)(f: (DynamicOptic, DynamicValue, B) => Either[SchemaError, B]): Either[SchemaError, B]

Folds over the DynamicValue structure top-down, allowing failure.

Folds over the DynamicValue structure top-down, allowing failure.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
def foldUp[B](z: B)(f: (DynamicOptic, DynamicValue, B) => B): B

Folds over the DynamicValue structure bottom-up. The function receives the current path, the DynamicValue, and the accumulator. Child values are folded before their parents.

Folds over the DynamicValue structure bottom-up. The function receives the current path, the DynamicValue, and the accumulator. Child values are folded before their parents.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
def foldUpOrFail[B](z: B)(f: (DynamicOptic, DynamicValue, B) => Either[SchemaError, B]): Either[SchemaError, B]

Folds over the DynamicValue structure bottom-up, allowing failure.

Folds over the DynamicValue structure bottom-up, allowing failure.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Navigates to the value(s) at the given path. Returns a DynamicValueSelection that may contain zero or more values.

Navigates to the value(s) at the given path. Returns a DynamicValueSelection that may contain zero or more values.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Navigates to an entry in a Map by key. Returns a DynamicValueSelection containing all matching values.

Navigates to an entry in a Map by key. Returns a DynamicValueSelection containing all matching values.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
def get(index: Int): DynamicValueSelection

Navigates to an element in a Sequence by index. Returns a DynamicValueSelection containing the value, or an error if index is out of bounds.

Navigates to an element in a Sequence by index. Returns a DynamicValueSelection containing the value, or an error if index is out of bounds.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
def getCase(name: String): DynamicValueSelection

Navigates into a Variant case by name. Returns a DynamicValueSelection containing the case value if the case matches.

Navigates into a Variant case by name. Returns a DynamicValueSelection containing the case value if the case matches.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Inserts a value at the given path. If the path already exists, returns the original DynamicValue unchanged.

Inserts a value at the given path. If the path already exists, returns the original DynamicValue unchanged.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Inserts a value at the given path. Returns Left with an error if the path already exists or the parent doesn't exist.

Inserts a value at the given path. Returns Left with an error if the path already exists or the parent doesn't exist.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
def is(t: DynamicValueType): Boolean

Returns true if this DynamicValue is of the specified type.

Returns true if this DynamicValue is of the specified type.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Merges this DynamicValue with another using the specified strategy.

Merges this DynamicValue with another using the specified strategy.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Modifies the value at the given path using a function. If the path doesn't exist, returns the original DynamicValue unchanged.

Modifies the value at the given path using a function. If the path doesn't exist, returns the original DynamicValue unchanged.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
def modifyOrFail(path: DynamicOptic)(pf: PartialFunction[DynamicValue, DynamicValue]): Either[SchemaError, DynamicValue]

Modifies the value at the given path using a partial function. Returns Left with an error if the path doesn't exist or the partial function is not defined.

Modifies the value at the given path using a partial function. Returns Left with an error if the path doesn't exist or the partial function is not defined.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Applies sortFields, sortMapKeys, dropNulls, dropUnits, and dropEmpty.

Applies sortFields, sortMapKeys, dropNulls, dropUnits, and dropEmpty.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Partitions elements/fields based on a predicate on the value. Returns a tuple of (matching, non-matching) DynamicValues.

Partitions elements/fields based on a predicate on the value. Returns a tuple of (matching, non-matching) DynamicValues.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Partitions elements/fields based on a predicate on both path and value. Returns a tuple of (matching, non-matching) DynamicValues.

Partitions elements/fields based on a predicate on both path and value. Returns a tuple of (matching, non-matching) DynamicValues.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Partitions elements/fields based on a predicate on the path. Returns a tuple of (matching, non-matching) DynamicValues.

Partitions elements/fields based on a predicate on the path. Returns a tuple of (matching, non-matching) DynamicValues.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Returns the primitive value if this is a Primitive, otherwise None.

Returns the primitive value if this is a Primitive, otherwise None.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
Source
Product.scala
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
Source
Product.scala

Projects only the specified paths from this DynamicValue. Creates a new DynamicValue containing only values at the given paths.

Projects only the specified paths from this DynamicValue. Creates a new DynamicValue containing only values at the given paths.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
def prune(p: DynamicValue => Boolean): DynamicValue

Recursively removes elements/fields for which the predicate returns true.

Recursively removes elements/fields for which the predicate returns true.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Recursively removes elements/fields for which the predicate on both path and value returns true.

Recursively removes elements/fields for which the predicate on both path and value returns true.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
def prunePath(p: DynamicOptic => Boolean): DynamicValue

Recursively removes elements/fields at paths for which the predicate returns true.

Recursively removes elements/fields at paths for which the predicate returns true.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
def retain(p: DynamicValue => Boolean): DynamicValue

Recursively keeps only elements/fields for which the predicate returns true.

Recursively keeps only elements/fields for which the predicate returns true.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Recursively keeps only elements/fields for which the predicate on both path and value returns true.

Recursively keeps only elements/fields for which the predicate on both path and value returns true.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
def retainPath(p: DynamicOptic => Boolean): DynamicValue

Recursively keeps only elements/fields at paths for which the predicate returns true.

Recursively keeps only elements/fields at paths for which the predicate returns true.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Wraps this DynamicValue in a DynamicValueSelection if its type matches the specified DynamicValueType, otherwise returns an empty selection.

Wraps this DynamicValue in a DynamicValueSelection if its type matches the specified DynamicValueType, otherwise returns an empty selection.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Wraps this DynamicValue in a DynamicValueSelection.

Wraps this DynamicValue in a DynamicValueSelection.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Sets a value at the given path. If the path doesn't exist, returns the original DynamicValue unchanged.

Sets a value at the given path. If the path doesn't exist, returns the original DynamicValue unchanged.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Sets a value at the given path. Returns Left with an error if the path doesn't exist.

Sets a value at the given path. Returns Left with an error if the path doesn't exist.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Recursively sorts all Record fields alphabetically.

Recursively sorts all Record fields alphabetically.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Recursively sorts all Map entries by key.

Recursively sorts all Map entries by key.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
def toEjson(indent: Int = ...): String

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
def toJson: Json

Converts this DynamicValue to a Json value.

Converts this DynamicValue to a Json value.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Converts this DynamicValue to a Chunk of path-value pairs. Each pair contains the path to a leaf value and the value itself.

Converts this DynamicValue to a Chunk of path-value pairs. Each pair contains the path to a leaf value and the value itself.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
DynamicValue -> Any
Inherited from:
DynamicValue
Source
DynamicValue.scala

Transforms this DynamicValue top-down using the given function. The function receives the current path and the DynamicValue at that path. Parent values are transformed before their children.

Transforms this DynamicValue top-down using the given function. The function receives the current path and the DynamicValue at that path. Parent values are transformed before their children.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala
def transformFields(f: (DynamicOptic, String) => String): DynamicValue

Transforms all Record field names using the given function. The function receives the current path and the field name at that path.

Transforms all Record field names using the given function. The function receives the current path and the field name at that path.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Transforms all Map keys using the given function. The function receives the current path and the key at that path.

Transforms all Map keys using the given function. The function receives the current path and the key at that path.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala

Transforms this DynamicValue bottom-up using the given function. The function receives the current path and the DynamicValue at that path. Child values are transformed before their parents.

Transforms this DynamicValue bottom-up using the given function. The function receives the current path and the DynamicValue at that path. Child values are transformed before their parents.

Attributes

Inherited from:
DynamicValue
Source
DynamicValue.scala