pub enum ValueType {
}Expand description
Declared value type of a property.
The names accepted on the wire are wider than the variants (see
ValueType::from_object_type_name); the variants are the
canonical set.
Variants§
Text
Free-form text.
Long
64-bit integer (SQL BIGINT). Wire names “Integer”/“Long” keep mapping here for backward compatibility with existing schemas.
Float
64-bit float (SQL DOUBLE PRECISION / FLOAT8).
Date
Calendar date (SQL DATE). Values validate + normalize to
YYYY-MM-DD; invalid input coerces to Null.
Bool
Boolean.
SmallInt
SQL SMALLINT: range-checked to i16 on ingress, stored as Long.
Int32
SQL INT/INTEGER (32-bit): range-checked to i32, stored as Long. Wire name “Int32”/“Int” (plain “Integer” stays Long, see above).
Decimal
SQL DECIMAL/NUMERIC. Values coerce to crate::Decimal — i128
unscaled digits plus a scale, exact, never f64.
UNPARAMETERIZED, deliberately. The declared (precision, scale)
stays in the source-schema mapping rather than here, because the
value already carries its own exact scale and reports its own
precision, which is enough for storage, comparison and
round-tripping. Adding them here would change the serde shape of
this variant from the string "Decimal" to a struct, and every
stored schema record and .ant schema_type payload is written
in the current shape.
REVISIT WHEN: the SQL auto-mapper needs to VALIDATE values
against declared column types — rejecting a scale-6 value
written into a DECIMAL(10,4) column, rather than storing it at
whatever scale it arrived with. That check cannot be made from
the value alone; it needs the declaration, and at that point the
declaration has to live here. Doing it will need a
backward-compatible deserializer that still accepts the bare
"Decimal" string.
Time
SQL TIME: normalized HH:MM:SS.ffffff (fixed 6-digit fraction
so lexicographic order == chronological order).
Timestamp
SQL TIMESTAMP/TIMESTAMPTZ: normalized UTC RFC3339 with fixed
6-digit fraction (YYYY-MM-DDTHH:MM:SS.ffffffZ) so lexicographic
order == chronological order. Offset-less input is taken as UTC.
Uuid
UUID/UNIQUEIDENTIFIER: validated 8-4-4-4-12 hex, lowercased.
Bytes
BLOB/BYTEA/VARBINARY: base64 text, charset/padding validated.
Json
JSON/JSONB, document-store subdocuments: stored as real JSON (PropertyValue::Json), not stringified.
Array(Box<ValueType>)
Typed array (Postgres arrays, document-store arrays): every element coerced against the inner type; stored as a JSON array.
Ref(TypeName)
Reference to another declared type by name.