pub enum OrderTarget {
Column(&'static str),
RelationScalar {
hops: Vec<RelationHop>,
column: &'static str,
},
VectorDistance {
column: &'static str,
metric: VectorMetric,
query_vector: Vec<f32>,
},
}Variants§
Column(&'static str)
RelationScalar
Order by column at the end of a to-one relation path, rendered
as nested correlated subqueries — one per hop, each applying that
hop’s crate::RelatedReadScope, so a related row the caller
cannot read yields NULL (GHSA-p55v-6xv5-93p3).
The path is carried as hops rather than a pre-rendered SQL string:
baking it per path at macro-expansion time is what made codegen
exponential in relation-graph connectivity (cratestack#252), and a
raw string cannot carry per-hop scopes. Build it with
OrderClause::relation_scalar or OrderClause::relation_path;
hops must not be empty.
VectorDistance
Order by distance to a query vector on a Vector(n) column (see
docs/design/extensions.md §6/§7, cratestack#163). Built via
FieldRef::distance_to(...).asc()/.desc() or the
order_by_distance shorthand. PG-only (pgvector) — the
embedded rusqlite backend doesn’t ship pgvector, so its
renderer fails loud, mirroring how FilterExpr::Spatial is
handled there.