Skip to main content

sort_column

Function sort_column 

Source
pub fn sort_column(prefix: &str, external: &str) -> String
Expand description

The ORDER-PRESERVING COMPANION COLUMN one sortable collection is mirrored into.

tags  →  __ig_tags_sort__

The ONE mint, and three parties spell it from here: the order-by term that renders it, the write plan that fills it, and the descriptor that creates it. A companion is unlike an edge table, whose name every party DERIVES — it is a real column of a real table, so it is minted once and carried, which is the arrangement a provenance table’s name already has.

§It is inside the SYNTHESIZED-COLUMN fence, and that is what makes it collision-proof

__ig_ in front and __ behind — the shape ingraph’s own interface::KIND states the law for, and one ingraph-derive refuses a DECLARED column for taking. So no record can spell this name, including one whose field is actually called tags_sort: that field’s own companion is __ig_tags_sort_sort__, and neither is a name a declaration could have written.

The join is INJECTIVE for the same reason: the field is everything between a fixed prefix and a fixed suffix, so two fields cannot reach one companion.

It takes the column’s EXTERNAL name — what <db>(rename) left it called in the database being emitted for — because the companion is a column of THAT table beside it.

§It takes the RESOLVED namespace, and that is a fix rather than a widening

prefix is the mark this DATABASE mints in — <db>(alias(prefix = …)) where the declaration named one, the model’s own EmissionPrefix where it did not. It is the caller’s to resolve, exactly as alias takes it. Spelling the framework’s own constant here instead was a real collision: a record that overrode the prefix on every database it names has had __ig* HANDED BACK by ingraph-derive’s fence and may declare a column called __ig_tags_sort__, which is precisely the name the companion for tags used to take.