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: boolWhen true, the database uses a SQL-based query language.
storage_types: StorageTypesColumn storage types supported by the database.
schema_mutations: SchemaMutationsSchema mutation capabilities supported by the datbase.
cte_with_update: boolSQL: supports update statements in CTE queries.
select_for_update: boolSQL: Supports row-level locking. If false, then the driver is expected to serializable transaction-level isolation.
returning_from_mutation: boolSQL: Mysql doesn’t support returning clauses from insert / update queries
primary_key_ne_predicate: boolDynamoDB does not support != predicates on the primary key.
auto_increment: boolWhether the database has an auto increment modifier for integer columns.
native_varchar: bool§native_timestamp: boolWhether the database has native support for Timestamp types.
native_date: boolWhether the database has native support for Date types.
native_time: boolWhether the database has native support for Time types.
native_datetime: boolWhether the database has native support for DateTime types.
native_decimal: boolWhether the database has native support for Decimal types.
bigdecimal_implemented: boolWhether 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: boolWhether 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: boolWhether 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: boolWhether 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
impl Capability
Sourcepub const POSTGRESQL: Self
pub const POSTGRESQL: Self
PostgreSQL capabilities
Sourcepub fn validate(&self) -> Result<()>
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.
Sourcepub fn default_string_max_length(&self) -> Option<u64>
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.
Sourcepub fn native_type_for(&self, ty: &Type) -> Type
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.