Skip to main content

DatabaseDriverFactory

Trait DatabaseDriverFactory 

Source
pub trait DatabaseDriverFactory:
    Send
    + Sync
    + 'static {
    // Required methods
    fn create(&self) -> Arc<dyn DatabaseDriver> ⓘ;
    fn driver_id(&self) -> &'static str;

    // Provided methods
    fn protocol_version(&self) -> u32 { ... }
    fn supports_cancel_query(&self) -> bool { ... }
    fn supports_explain(&self) -> bool { ... }
    fn supports_streaming_results(&self) -> bool { ... }
    fn create_kv(&self) -> Option<Arc<dyn KeyValueDriver>> { ... }
}
Expand description

Factory that plugins implement to register their driver. Use the [register_driver!] macro for convenient registration.

Required Methods§

Source

fn create(&self) -> Arc<dyn DatabaseDriver> ⓘ

Create an instance of the driver.

Source

fn driver_id(&self) -> &'static str

Unique string identifier for this driver (e.g. “kiwi”, “redis”).

Provided Methods§

Source

fn protocol_version(&self) -> u32

Protocol version this plugin was compiled against.

Source

fn supports_cancel_query(&self) -> bool

Whether this driver supports query cancellation.

Source

fn supports_explain(&self) -> bool

Whether this driver supports EXPLAIN analysis.

Source

fn supports_streaming_results(&self) -> bool

Whether this driver supports streaming results.

Source

fn create_kv(&self) -> Option<Arc<dyn KeyValueDriver>>

If this driver also implements KeyValueDriver, return it. Default returns None.

Trait Implementations§

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§