Skip to main content

ValueOwned

Type Alias ValueOwned 

Source
pub type ValueOwned = Value<'static>;
Expand description

Owned Value — heap-bearing variants are Cow::Owned. Used everywhere a Value must outlive a query-scoped arena (catalog defaults, persistent storage, public APIs).

Aliased Type§

pub enum ValueOwned {
Show 61 variants SmallInt(i16), Int(i32), BigInt(i64), Float(f64), Text(Cow<'static, str>), Bool(bool), Vector(Cow<'static, [f32]>), Sq8Vector(Sq8Vector), HalfVector(HalfVector), Numeric { scaled: i128, scale: u8, }, Date(i32), Timestamp(i64), Interval { months: i32, days: i32, micros: i64, }, Json(Cow<'static, str>), Bytes(Cow<'static, [u8]>), TextArray(Vec<Option<String>>), IntArray(Vec<Option<i32>>), BigIntArray(Vec<Option<i64>>), IntervalArray(Vec<Option<IntervalSpan>>), BoolArray(Vec<Option<bool>>), SmallIntArray(Vec<Option<i16>>), FloatArray(Vec<Option<f64>>), NumericArray(Vec<Option<(i128, u8)>>), DateArray(Vec<Option<i32>>), TimestampArray(Vec<Option<i64>>), TimestamptzArray(Vec<Option<i64>>), UuidArray(Vec<Option<[u8; 16]>>), JsonArray(Vec<Option<String>>), JsonbArray(Vec<Option<String>>), BytesArray(Vec<Option<Vec<u8>>>), VarcharArray(Vec<Option<String>>), CharArray(Vec<Option<String>>), Multirange { kind: RangeKind, ranges: Vec<RangeSpan>, }, Point(Point2D), Lseg(Point2D, Point2D), Path { points: Vec<Point2D>, closed: bool, }, PgBox(Point2D, Point2D), Polygon(Vec<Point2D>), Line { a: f64, b: f64, c: f64, }, Circle { center: Point2D, radius: f64, }, Inet { family: u8, bits: u8, addr: [u8; 16], }, Cidr { family: u8, bits: u8, addr: [u8; 16], }, Macaddr([u8; 6]), Macaddr8([u8; 8]), BitString { nbits: u32, bytes: Cow<'static, [u8]>, }, Xml(Cow<'static, str>), Char1(u8), MoneyArray(Vec<Option<i64>>), TsVector(Vec<TsLexeme>), TsQuery(TsQueryAst), Uuid([u8; 16]), Time(i64), Year(u16), TimeTz { us: i64, offset_secs: i32, }, Money(i64), Hstore(Vec<(String, Option<String>)>), IntArray2D(Vec<Vec<Option<i32>>>), BigIntArray2D(Vec<Vec<Option<i64>>>), TextArray2D(Vec<Vec<Option<String>>>), Range { kind: RangeKind, lower: Option<Box<Value<'static>>>, upper: Option<Box<Value<'static>>>, lower_inc: bool, upper_inc: bool, empty: bool, }, Null,
}

Variants§

§

SmallInt(i16)

§

Int(i32)

§

BigInt(i64)

§

Float(f64)

§

Text(Cow<'static, str>)

§

Bool(bool)

§

Vector(Cow<'static, [f32]>)

§

Sq8Vector(Sq8Vector)

v6.0.1: 8-bit scalar-quantised vector cell. Lives in columns declared VECTOR(N) USING SQ8. Layout per cell: Sq8Vector { min: f32, max: f32, bytes: Vec<u8> } — 4× compression vs Vector(Vec<f32>). The wire layer dequantises to f32 on SELECT; INSERT path quantises incoming Vector(Vec<f32>) cells into this variant.

§

HalfVector(HalfVector)

v6.0.3: IEEE-754 binary16 vector cell. Lives in columns declared VECTOR(N) USING HALF. Stores raw u16 LE bits (2× compression vs Vector(Vec<f32>)). Wire / display paths dequantise to f32 bit-exactly; INSERT path converts incoming f32 vectors at the engine boundary.

§

Numeric

Exact fixed-point decimal. scaled holds the value as actual * 10^scale so the storage type is always integral — arithmetic never falls back to floating-point.

Fields

§scaled: i128
§scale: u8
§

Date(i32)

Days since the Unix epoch (1970-01-01). Negative for earlier dates.

§

Timestamp(i64)

Microseconds since the Unix epoch (1970-01-01T00:00:00Z).

§

Interval

Calendar span: months + days + micros. Three fields are required for PG byte-equal: '1 day''24 hours' (DST, month-boundary, and the on-wire pg_type interval are all i64 micros + i32 days + i32 months). v7.37.5 β widened from {months, micros}; column storage lands in the same window.

Fields

§months: i32
§days: i32
§micros: i64
§

Json(Cow<'static, str>)

v4.9 JSON — raw JSON text. No structural validation happens at the storage layer; whatever the parser hands us round-trips verbatim. Equality is byte-wise.

§

Bytes(Cow<'static, [u8]>)

v7.10.4 BYTEA — raw binary blob. Equality is byte-wise. Layout matches Text’s length-prefixed shape ([u32 LE len][bytes]) under tag 18; the engine accepts PG hex literals ('\xDEADBEEF') and escape literals at the coercion boundary.

§

TextArray(Vec<Option<String>>)

v7.10.9 TEXT[] — single-dimension TEXT array with optional NULL elements. Equality is element-wise. PG’s NULL-element comparison semantics: NULL ≠ NULL inside arrays under =, so [NULL] != [NULL] (the engine honours this).

§

IntArray(Vec<Option<i32>>)

v7.11.12 INT[] — single-dimension i32 array with optional NULL elements. Codec mirrors TextArray with i32 LE per element instead of length-prefixed UTF-8.

§

BigIntArray(Vec<Option<i64>>)

v7.11.12 BIGINT[] — single-dimension i64 array with optional NULL elements.

§

IntervalArray(Vec<Option<IntervalSpan>>)

v7.37.5 β-P4 INTERVAL[] — single-dimension array of IntervalSpan { months, days, micros } with optional NULL elements. PG external form quotes each non-NULL element ({"1 day","24:00:00",NULL}) because interval text contains spaces and colons. Storage codec follows the BigIntArray shape with a 16-byte per-element body.

§

BoolArray(Vec<Option<bool>>)

v7.37.5 γ — single-dimension arrays of the remaining PG scalar types. Each carries Vec<Option<T>> with the scalar’s natural Rust shape; element NULLs are first-class (per PG: {1,NULL,3} is a 3-element array, not a 2-element one). Codec follows the IntervalArray shape — [u16 count] [per elem: u8 null + (non-null) scalar body].

§

SmallIntArray(Vec<Option<i16>>)

§

FloatArray(Vec<Option<f64>>)

§

NumericArray(Vec<Option<(i128, u8)>>)

PG NUMERIC[](scaled: i128, scale: u8) per element.

§

DateArray(Vec<Option<i32>>)

§

TimestampArray(Vec<Option<i64>>)

§

TimestamptzArray(Vec<Option<i64>>)

§

UuidArray(Vec<Option<[u8; 16]>>)

§

JsonArray(Vec<Option<String>>)

§

JsonbArray(Vec<Option<String>>)

§

BytesArray(Vec<Option<Vec<u8>>>)

§

VarcharArray(Vec<Option<String>>)

§

CharArray(Vec<Option<String>>)

§

Multirange

v7.37.5 δ — PG 14+ multirange. ranges is a Vec of non-overlapping bounds spans of the shared kind. PG’s canonical text form is {[a,b),[c,d),...} (comma-separated ranges in braces; {} for the empty multirange). SPG’s constructor enforces no overlap/coalescing — for now the engine trusts the caller (mirrors PG’s _construct_array pattern). Catalog tag 49 + 1-byte RangeKind on the dense type-tag side; schema-less path is unreachable (multirange is column-typed only).

Fields

§ranges: Vec<RangeSpan>
§

Point(Point2D)

v7.37.5 ε — PG geometry scalars. Per-type Vec/struct shape; codec body shape is described on the matching DataType variant. PG canonical text forms: Point (x,y) Lseg [(x1,y1),(x2,y2)] Path open [(x,y),(x,y),...] / closed ((x,y),(x,y),...) Box (ux,uy),(lx,ly) (PG normalises to upper-right + lower-left) Polygon ((x,y),(x,y),...) (implicit closed) Line {a,b,c} (Ax + By + C = 0) Circle <(x,y),r>

§

Lseg(Point2D, Point2D)

§

Path

closed = true is ((p,p,...)); false is [(p,p,...)].

Fields

§points: Vec<Point2D>
§closed: bool
§

PgBox(Point2D, Point2D)

PG box — stored as (upper_right, lower_left) (PG’s normalised order). The engine accepts both endpoint orderings at parse time and normalises here.

§

Polygon(Vec<Point2D>)

§

Line

Fields

§

Circle

Fields

§center: Point2D
§radius: f64
§

Inet

v7.37.5 ζ-A — PG inet. family = 4 (IPv4) or 6 (IPv6). bits is the netmask bit count (0..=32 for IPv4, 0..=128 for IPv6). addr is right-padded with zeros when family=4 (first 4 bytes are the address).

Fields

§family: u8
§bits: u8
§addr: [u8; 16]
§

Cidr

v7.37.5 ζ-A — PG cidr. Same shape as Inet; CIDR’s invariant (host bits zero) is enforced at parse / coerce.

Fields

§family: u8
§bits: u8
§addr: [u8; 16]
§

Macaddr([u8; 6])

v7.37.5 ζ-A — PG macaddr. 6 bytes (XX:XX:XX:XX:XX:XX).

§

Macaddr8([u8; 8])

v7.37.5 ζ-A — PG macaddr8. 8 bytes (EUI-64).

§

BitString

v7.37.5 ζ-A — PG bit / bit varying. nbits is the actual bit count; bytes is the packed representation (big-endian within each byte; final byte right-padded with 0s if nbits % 8 != 0).

Fields

§nbits: u32
§bytes: Cow<'static, [u8]>
§

Xml(Cow<'static, str>)

v7.37.5 ζ-A — PG xml. Stored verbatim as a string; no parse-time validation (matches the SPG JSON convention).

§

Char1(u8)

v7.37.5 ζ-A — PG "char" (internal single-byte type, distinct from CHAR(n)).

§

MoneyArray(Vec<Option<i64>>)

v7.37.5 ζ-A — PG money[].

§

TsVector(Vec<TsLexeme>)

v7.12.0 tsvector — sorted-by-word, deduped lexeme set with positions + weights. The engine enforces sort/dedup on construction; consumers can rely on lexemes.windows(2) being strictly ascending by word.

§

TsQuery(TsQueryAst)

v7.12.0 tsquery — boolean / phrase parse tree over lexemes. Engine builds via to_tsquery family.

§

Uuid([u8; 16])

v7.17.0 uuid — 128-bit identifier. Stored as 16 bytes (big-endian / network-byte order, same as RFC 4122). Display normalises to canonical lowercase 8-4-4-4-12 hyphenated form. Equality is byte-wise.

§

Time(i64)

v7.17.0 Phase 3.P0-32 — PG time (without time zone) — i64 microseconds since 00:00:00. Range 0..86_400_000_000. Display: HH:MM:SS zero-padded, with optional .ffffff suffix when fractional is non-zero.

§

Year(u16)

v7.17.0 Phase 3.P0-33 — MySQL YEAR — u16 in range 1901..=2155 plus the special zero-year sentinel 0. Display always 4 digits zero-padded (0000 for the sentinel; 1985/2007 otherwise).

§

TimeTz

v7.17.0 Phase 3.P0-34 — PG time with time zone — i64 microseconds since 00:00:00 in the LOCAL wall clock PLUS an i32 offset-from-UTC in seconds. PG preserves the offset on output, so the wall-clock value is NOT shifted to UTC at storage time. Offset range: ±50400 seconds (±14 hours).

Fields

§us: i64
§offset_secs: i32
§

Money(i64)

v7.17.0 Phase 3.P0-35 — PG money — i64 cents (locale-independent storage; the en_US locale renders on display via $N,NNN.CC).

§

Hstore(Vec<(String, Option<String>)>)

v7.17.0 Phase 3.P0-39 — PG hstore value: flat text => text map with NULL value support. Insertion order preserved on input; duplicate keys take last-write- wins at parse time.

§

IntArray2D(Vec<Vec<Option<i32>>>)

v7.17.0 Phase 3.P0-40 — 2D INT matrix (row-major).

§

BigIntArray2D(Vec<Vec<Option<i64>>>)

v7.17.0 Phase 3.P0-40 — 2D BIGINT matrix (row-major).

§

TextArray2D(Vec<Vec<Option<String>>>)

v7.17.0 Phase 3.P0-40 — 2D TEXT matrix (row-major).

§

Range

v7.17.0 Phase 3.P0-38 — PG range value. One shape covers all six builtin range types; kind pins the element type (must match the column’s DataType::Range(kind)). lower / upper are None for the unbounded sides; lower_inc / upper_inc mirror the canonical PG [ / ( / ] / ) bracket inclusivity. empty=true supersedes all other fields (the empty range has no bounds).

Fields

§lower: Option<Box<Value<'static>>>
§upper: Option<Box<Value<'static>>>
§lower_inc: bool
§upper_inc: bool
§empty: bool
§

Null