zio.blocks.schema.PrimitiveValue
See thePrimitiveValue companion object
A PrimitiveValue is a scalar value inside a DynamicValue, which DynamicValue.Primitive wraps. There is one case per PrimitiveType, and each case keeps the exact Scala or Java type of its value: Int(2021) and Long(2021L) are different values.
Primitive values are ordered: two values of the same case by their value, and values of different cases by the order of the cases, from Unit to UUID (see typeIndex). PrimitiveValue.ordering and DynamicValue#compare use this order. Int values are compared by subtraction, which overflows, so two Int values that are more than Int.MaxValue apart compare the wrong way round.
val title = PrimitiveValue.String("Zionomicon")
val year = PrimitiveValue.Int(2021)
val kind = year.primitiveType // Int(None)
val before = year < PrimitiveValue.Int(2024) // true
val sorted = List[PrimitiveValue](title, year).sorted // List(Int(2021), String(Zionomicon))
val value = DynamicValue.Primitive(title) // "Zionomicon"
Attributes
- See also
- Companion
- object
- Source
- PrimitiveValue.scala
- Graph
-
- Supertypes
- Known subtypes
-
class BigDecimalclass BigIntclass Booleanclass Byteclass Charclass Currencyclass DayOfWeekclass Doubleclass Durationclass Floatclass Instantclass Intclass LocalDateclass LocalDateTimeclass LocalTimeclass Longclass Monthclass MonthDayclass OffsetDateTimeclass OffsetTimeclass Periodclass Shortclass Stringclass UUIDobject Unitclass Yearclass YearMonthclass ZoneIdclass ZoneOffsetclass ZonedDateTime
Members list
In this article