ForeignKeys

Enum ForeignKeys 

Source
#[non_exhaustive]
pub enum ForeignKeys { Rust, SQLite, }
Expand description

Which method should be used to check foreign-key constraints.

The default is ForeignKeys::SQLite, but this is likely to change to ForeignKeys::Rust.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Rust

Foreign-key constraints are checked by rust-query only.

Most foreign-key checks are done at compile time and are thus completely free. However, some runtime checks are required for deletes.

§

SQLite

Foreign-key constraints are checked by SQLite in addition to the checks done by rust-query.

This is useful when using rust-query with crate::TransactionWeak::rusqlite_transaction or when other software can write to the database. Both can result in “dangling” foreign keys (which point at a non-existent row) if written incorrectly. Dangling foreign keys can result in wrong results, but these dangling foreign keys can also turn into “false” foreign keys if a new record is inserted that makes the foreign key valid. This is a lot worse than a dangling foreign key, because it is generally not possible to detect.

With the ForeignKeys::SQLite option, rust-query will prevent creating such false foreign keys and panic instead. The downside is that indexes are required on all foreign keys to make the checks efficient.

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V