Skip to main content

BackendCapabilities

Struct BackendCapabilities 

Source
pub struct BackendCapabilities {
Show 13 fields pub kind: BackendKind, pub transactions: TransactionSupport, pub row_locking: RowLocking, pub joins: bool, pub returning: bool, pub window_functions: bool, pub regex: bool, pub arrays: bool, pub distinct_on: bool, pub ilike: bool, pub statistical_aggregates: bool, pub max_params: usize, pub isolation_levels: &'static [IsolationLevel],
}
Expand description

Declared capabilities of a backend.

Fields§

§kind: BackendKind

Backend family.

§transactions: TransactionSupport

Transaction support level.

§row_locking: RowLocking

Row-locking support level.

§joins: bool

JOIN support.

§returning: bool

RETURNING support.

§window_functions: bool

Window function support.

§regex: bool

Regex lookups.

§arrays: bool

Native arrays.

§distinct_on: bool

DISTINCT ON.

§ilike: bool

Native ILIKE.

§statistical_aggregates: bool

STDDEV / VARIANCE aggregates.

§max_params: usize

Most bind parameters one statement may carry; bulk operations chunk their rows to stay below it.

§isolation_levels: &'static [IsolationLevel]

Isolation levels that can be requested explicitly.

Implementations§

Source§

impl BackendCapabilities

Source

pub const fn postgres() -> Self

Capabilities of PostgreSQL (12+).

Source

pub const fn sqlite() -> Self

Capabilities of SQLite (3.35+ for RETURNING, 3.25+ for windows).

SQLite has no row locking, no built-in REGEXP function and no STDDEV / VARIANCE. Its transactions are always serializable. The parameter limit is that of SQLite 3.32 and later.

Source

pub const fn mysql() -> Self

Capabilities of MySQL 8.0.31+ (tested on 9.x).

  • returning is true although MySQL has no RETURNING clause: the adapter emulates it (generated keys via LAST_INSERT_ID(), other writes by re-reading the affected rows in the same transaction).
  • There is no DISTINCT ON, no native array type or array aggregate and no ILIKE (emulated with LOWER(..) LIKE LOWER(..)).
  • Regex uses REGEXP_LIKE; row locking supports NOWAIT and SKIP LOCKED; all three isolation levels can be requested.
Source

pub const fn mongodb() -> Self

Capabilities of MongoDB (5.0+; transactions need a replica set).

The plan is compiled to filters and aggregation pipelines: no joins, row locking, window functions, arrays, DISTINCT ON, subqueries, set operations or raw SQL. RETURNING is emulated by the adapter. Transactions are flat (no savepoints) and no isolation level can be requested. max_params bounds the rows per insert_many batch.

Source

pub const fn redis() -> Self

Capabilities of Redis as a key, hash and set store.

Redis is not a QuerySet backend. Every relational feature is unsupported, so a plan checked against these capabilities fails with a BackendCapabilityError before any I/O. Multi-key atomicity is one MULTI/EXEC (TransactionSupport::Flat): there are no savepoints and no SQL isolation levels. max_params is 0 because Redis does not bind SQL parameters.

Source

pub fn supports(&self, feature: Feature) -> bool

Whether feature is supported.

Source

pub fn require(&self, feature: Feature) -> Result<(), BackendCapabilityError>

Return Ok(()) if feature is supported, otherwise a typed error.

Trait Implementations§

Source§

impl Clone for BackendCapabilities

Source§

fn clone(&self) -> BackendCapabilities

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 Debug for BackendCapabilities

Source§

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

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

impl Eq for BackendCapabilities

Source§

impl PartialEq for BackendCapabilities

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BackendCapabilities

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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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 = 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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more