pub enum DatabaseKind {
Sqlite,
Postgres,
Mysql,
Mongo,
}Expand description
A database a record may be stored in.
A CLOSED vocabulary, and deliberately so: this is the framework’s own list of backends, and each one’s row carries a different derive, a different rename attribute and a different dialect. An open seam belongs where a user extends the framework; a database the framework does not ship an emitter for has nothing to be opened.
Variants§
Implementations§
Source§impl DatabaseKind
impl DatabaseKind
Sourcepub const fn as_str(self) -> &'static str
pub const fn as_str(self) -> &'static str
The name a declaration writes: sqlite, postgres, mysql, mongo.
Sourcepub const fn retired_arm(self) -> &'static str
pub const fn retired_arm(self) -> &'static str
The arm of ingraph::drive::RetiredEngine this database is — what the retired(<engine>)
word emits.
A SECOND mapping beside suffix rather than a reuse of it, because the two
name different things: suffix is sqlx’s own spelling of a DRIVER (MySql), and this is an
arm of a framework enum whose spelling is the framework’s (Mysql). One drifting into the
other would emit a path that does not exist.
Sourcepub const fn generations_arm(self) -> Option<&'static str>
pub const fn generations_arm(self) -> Option<&'static str>
The arm of ingraph::drive::GenerationsEngine this database is — what the
generations(<engine>) word emits — or None where this database has no arm there.
retired_arm’s sibling, and a THIRD mapping for its reason: two framework
enums are two vocabularies, and one spelling serving both is how they come to disagree.
It differs from that one in being PARTIAL. Mongo answers None, and the
absence is the generations seat’s own scope rather than an oversight: its retention duty is an
anchored DELETE whose bound is a correlated subquery over a table’s distinct runs, which is a
SQL shape. A document store sweeps the same closure by MEMBERSHIP, which is a second
implementation of ingraph::GenerationsStore and not a fourth arm here — so the retirement
ledger takes four words and this takes three.
Sourcepub const fn suffix(self) -> &'static str
pub const fn suffix(self) -> &'static str
The suffix the emitted row type takes when nothing renamed it — sqlx’s own spellings.
Sourcepub const fn backend(self) -> (&'static [&'static str], &'static str)
pub const fn backend(self) -> (&'static [&'static str], &'static str)
The SHELF path a CONCRETE backend type is reached through — the module segments and the item.
The ONE authority on which type each database IS, because two emissions now name one: a
record’s storability audit binds Record<Db> at it, and an interface’s row equation projects
through the same trait at the same backend. Two spellings of one mapping is how a declaration
comes to be audited at one backend and read at another.
MongoDB’s is not under the vendored sqlx segment: its backend is this crate’s own name, for
the reason comparison::mongo::Mongo gives — there is no driver unit struct to borrow, because
a MongoDB comparison has no dialect to remember.
Sourcepub const fn dialect(self) -> (&'static [&'static str], &'static str)
pub const fn dialect(self) -> (&'static [&'static str], &'static str)
The CURSOR seam’s marker for this database — the module segments and the item.
A second mapping beside backend rather than a reuse of it, because the two
answer different questions. A backend is the DRIVER, and every emission that names one rides
that dialect’s feature gate. A cursor’s bytes name no driver — ingraph::cursor is compiled
under no backend’s feature, a position in a written order naming no database — so the seam
that says WHICH STORE’s bytes these are is keyed on a marker the framework always ships, and
every mention of it is ungated.
Sourcepub const fn is_sql(self) -> bool
pub const fn is_sql(self) -> bool
Whether this database speaks SQL — which decides the row’s derives, its rename attribute, and
whether it has a schema and a table rather than a collection.
Sourcepub const fn edge_collections(self) -> bool
pub const fn edge_collections(self) -> bool
Whether a COLLECTION column is kept in a second table here, so its elements are rows and not a value of the record’s own row.
This is ingraph’s CollectionStorage read one layer up, and only the two dialects whose row
is unconditional can be read: SQLite and MySQL have no array type, so every collection they
store goes to an edge table whatever its element is. Both answer true here for exactly the
reason their impls carry no choice.
Postgres answers false, and that is its DEFAULT rather than its only answer. Its strategy
is a fact about the ELEMENT — PgCollectionStorage’s row says whether an array can hold one,
and lets a row decline the array anyway — and a row is a trait implementation, which a macro
reading tokens cannot see. So the dialect answers with the default here and the DECLARATION
says otherwise where it must: PersistColumn::edge, the optional word, which is the other
half of the same question and the one place the element-level fact can be stated.
Mongo answers false because it has no edge table to answer with: a document holds its own
array, and none of the SQL plan reaches it.