Unit

zio.blocks.schema.PrimitiveType.Unit
case object Unit extends PrimitiveType[Unit]

The primitive type of Unit, without validation. It decodes only PrimitiveValue.Unit.

Attributes

Source
PrimitiveType.scala
Graph
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait PrimitiveType[Unit]
class Object
trait Matchable
class Any
Show all
Self type
Unit.type

Members list

Type members

Inherited types

type MirroredElemLabels = EmptyTuple

The names of the product elements.

The names of the product elements.

Attributes

Inherited from:
Singleton
Source
Mirror.scala
type MirroredElemTypes = EmptyTuple

Attributes

Inherited from:
Singleton
Source
Mirror.scala
type MirroredMonoType = this.type

The mirrored *-type.

The mirrored *-type.

Attributes

Inherited from:
Singleton
Source
Mirror.scala
type MirroredType = this.type

Attributes

Inherited from:
Singleton
Source
Mirror.scala

Inherited and Abstract types

type MirroredLabel <: String

The name of the type.

The name of the type.

Attributes

Inherited from:
Mirror
Source
Mirror.scala

Value members

Concrete methods

def toDynamicValue(value: Unit): DynamicValue

Wraps value in a DynamicValue.Primitive of the matching PrimitiveValue case.

Wraps value in a DynamicValue.Primitive of the matching PrimitiveValue case.

Attributes

Source
PrimitiveType.scala
def typeId: TypeId[Unit]

Returns the type ID of A.

Returns the type ID of A.

Attributes

Source
PrimitiveType.scala
def validation: Validation[Unit]

Returns the validation of the values of this type, Validation.None when there is none.

Returns the validation of the values of this type, Validation.None when there is none.

Attributes

Source
PrimitiveType.scala

Inherited methods

def binding: Binding[Primitive, Unit]

Returns the binding of a primitive node of this type.

Returns the binding of a primitive node of this type.

Attributes

Inherited from:
PrimitiveType
Source
PrimitiveType.scala
def fromDynamicValue(value: DynamicValue): Either[SchemaError, Unit]

Converts value into an A, or returns an ExpectationMismatch error such as Expected Int. value must be a DynamicValue.Primitive. The numeric types and Char also accept a primitive value of one of the other numeric types or Char when converting it to this type and back gives the same value; every other type accepts only its own PrimitiveValue case. Because the JVM conversions saturate or wrap, a few lossy conversions pass that check: a Float or Double of 2^63 decodes as Long.MaxValue, a Float of 2^31 as Int.MaxValue, Int.MaxValue as the Float 2^31, Long.MaxValue as the Float or Double 2^63, a Char of 32768 or more as a negative Short (65408 or more as a negative Byte), and a negative Byte or Short as a Char of 65408 or 32768 or more (-1 as Char.MaxValue). The validation is not checked.

Converts value into an A, or returns an ExpectationMismatch error such as Expected Int. value must be a DynamicValue.Primitive. The numeric types and Char also accept a primitive value of one of the other numeric types or Char when converting it to this type and back gives the same value; every other type accepts only its own PrimitiveValue case. Because the JVM conversions saturate or wrap, a few lossy conversions pass that check: a Float or Double of 2^63 decodes as Long.MaxValue, a Float of 2^31 as Int.MaxValue, Int.MaxValue as the Float 2^31, Long.MaxValue as the Float or Double 2^63, a Char of 32768 or more as a negative Short (65408 or more as a negative Byte), and a negative Byte or Short as a Char of 65408 or 32768 or more (-1 as Char.MaxValue). The validation is not checked.

val year = PrimitiveType.Int(Validation.None)

val fromLong = year.fromDynamicValue(
 DynamicValue.Primitive(PrimitiveValue.Long(2021L))
) // Right(2021)
val fromDouble = year.fromDynamicValue(
 DynamicValue.Primitive(PrimitiveValue.Double(2021.5))
) // Left(zio.blocks.schema.SchemaError: Expected Int at: .)

Attributes

Inherited from:
PrimitiveType
Source
PrimitiveType.scala
def fromProduct(p: Product): MirroredMonoType

Creates a new instance of type T with elements taken from product p.

Creates a new instance of type T with elements taken from product p.

Attributes

Inherited from:
Singleton
Source
Mirror.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