Skip to main content

Backend

Trait Backend 

Source
pub trait Backend:
    Send
    + Sync
    + DynClone {
    // Required methods
    fn name(&self) -> &'static str;
    fn row_id_column(&self) -> Option<&'static str>;
    fn create_migration_sql(
        &self,
        current: &ADB,
        ops: Vec<Operation>,
    ) -> Result<String>;
    fn connect(&self, conn_str: &str) -> Result<Connection>;
}
Expand description

Database backend. A boxed implementation can be returned by name via get_backend.

Required Methods§

Source

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

Butane name for the backend.

Source

fn row_id_column(&self) -> Option<&'static str>

Backend-dependent field name for the database’s internal identifier for each row.

It may be used to sort the rows in the order they were inserted, however consult the backend documentation for the exact behavior. For example, SQLite uses rowid and PostgreSQL uses ctid. This is not the same as the primary key of the table. It may be None if the backend does not support this.

Source

fn create_migration_sql( &self, current: &ADB, ops: Vec<Operation>, ) -> Result<String>

Source

fn connect(&self, conn_str: &str) -> Result<Connection>

Establish a new sync connection.

The format of the connection string is backend-dependent.

Trait Implementations§

Source§

impl Backend for Box<dyn Backend>

Source§

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

Butane name for the backend.
Source§

fn row_id_column(&self) -> Option<&'static str>

Backend-dependent field name for the database’s internal identifier for each row. Read more
Source§

fn create_migration_sql( &self, current: &ADB, ops: Vec<Operation>, ) -> Result<String>

Source§

fn connect(&self, conn_str: &str) -> Result<Connection>

Establish a new sync connection. Read more

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Backend for Box<dyn Backend>

Source§

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

Source§

fn row_id_column(&self) -> Option<&'static str>

Source§

fn create_migration_sql( &self, current: &ADB, ops: Vec<Operation>, ) -> Result<String>

Source§

fn connect(&self, conn_str: &str) -> Result<Connection>

Implementors§