Capability

Struct Capability 

Source
pub struct Capability {
Show 18 fields pub sql: bool, pub storage_types: StorageTypes, pub schema_mutations: SchemaMutations, pub cte_with_update: bool, pub select_for_update: bool, pub returning_from_mutation: bool, pub primary_key_ne_predicate: bool, pub auto_increment: bool, pub native_varchar: bool, pub native_timestamp: bool, pub native_date: bool, pub native_time: bool, pub native_datetime: bool, pub native_decimal: bool, pub bigdecimal_implemented: bool, pub decimal_arbitrary_precision: bool, pub index_or_predicate: bool, pub test_connection_pool: bool,
}

Fields§

§sql: bool

When true, the database uses a SQL-based query language.

§storage_types: StorageTypes

Column storage types supported by the database.

§schema_mutations: SchemaMutations

Schema mutation capabilities supported by the datbase.

§cte_with_update: bool

SQL: supports update statements in CTE queries.

§select_for_update: bool

SQL: Supports row-level locking. If false, then the driver is expected to serializable transaction-level isolation.

§returning_from_mutation: bool

SQL: Mysql doesn’t support returning clauses from insert / update queries

§primary_key_ne_predicate: bool

DynamoDB does not support != predicates on the primary key.

§auto_increment: bool

Whether the database has an auto increment modifier for integer columns.

§native_varchar: bool§native_timestamp: bool

Whether the database has native support for Timestamp types.

§native_date: bool

Whether the database has native support for Date types.

§native_time: bool

Whether the database has native support for Time types.

§native_datetime: bool

Whether the database has native support for DateTime types.

§native_decimal: bool

Whether the database has native support for Decimal types.

§bigdecimal_implemented: bool

Whether BigDecimal driver support is implemented. TODO: Remove this flag when PostgreSQL BigDecimal support is implemented. Currently only MySQL has implemented BigDecimal driver support.

§decimal_arbitrary_precision: bool

Whether the database’s decimal type supports arbitrary precision. When false, the decimal type requires fixed precision and scale to be specified upfront.

  • PostgreSQL: true (NUMERIC supports arbitrary precision)
  • MySQL: false (DECIMAL requires fixed precision/scale)
  • SQLite/DynamoDB: false (no native decimal support, stored as TEXT)
§index_or_predicate: bool

Whether OR is supported in index key conditions (e.g. DynamoDB KeyConditionExpression). DynamoDB: false. All other backends: true (SQL backends never use index key conditions).

§test_connection_pool: bool

Whether to test connection pool behavior. TODO: We only need this for the connection_per_clone.rs test, come up with a better way.

Implementations§

Source§

impl Capability

Source

pub const SQLITE: Self

SQLite capabilities.

Source

pub const POSTGRESQL: Self

PostgreSQL capabilities

Source

pub const MYSQL: Self

MySQL capabilities

Source

pub const DYNAMODB: Self

DynamoDB capabilities

Source

pub fn validate(&self) -> Result<()>

Validates the consistency of the capability configuration.

This performs sanity checks to ensure the capability fields are internally consistent. For example, if native_varchar is true, then storage_types.varchar must be Some, and vice versa.

Returns an error if any inconsistencies are found.

Source

pub fn default_string_max_length(&self) -> Option<u64>

Returns the default string length limit for this database.

This is useful for tests and applications that need to respect database-specific string length constraints.

Source

pub fn native_type_for(&self, ty: &Type) -> Type

Returns the native database type for an application-level type.

If the database supports the type natively, returns the same type. Otherwise, returns the bridge/storage type that the application type maps to in this database.

This uses the existing db::Type::bridge_type() method to determine the appropriate bridge type based on the database’s storage capabilities.

Trait Implementations§

Source§

impl Debug for Capability

Source§

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

Formats the value using the given formatter. Read more

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

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

§

fn vzip(self) -> V