Skip to main content

DatabaseKind

Enum DatabaseKind 

Source
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§

§

Sqlite

SQLite.

§

Postgres

PostgreSQL.

§

Mysql

MySQL.

§

Mongo

MongoDB.

Implementations§

Source§

impl DatabaseKind

Source

pub const ALL: [Self; 4]

Every database, in the order a refusal lists them.

Source

pub const fn as_str(self) -> &'static str

The name a declaration writes: sqlite, postgres, mysql, mongo.

Source

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.

Source

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.

Source

pub const fn suffix(self) -> &'static str

The suffix the emitted row type takes when nothing renamed it — sqlx’s own spellings.

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for DatabaseKind

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for DatabaseKind

Source§

impl Debug for DatabaseKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for DatabaseKind

Source§

impl Hash for DatabaseKind

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for DatabaseKind

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for DatabaseKind

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for DatabaseKind

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for DatabaseKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.