34 stable releases
4.5.52 | Apr 29, 2025 |
---|---|
4.5.48 | Feb 22, 2025 |
4.5.45 | Dec 12, 2024 |
4.5.41 | Nov 16, 2024 |
0.1.22 | Sep 15, 2022 |
#1064 in Database interfaces
2,245 downloads per month
Used in 33 crates
(15 directly)
175KB
5K
SLoC
RBDC driver abstract
- an database driver abstract for rbatis
- supported database drivers see rbatis
how to define my driver to support rbdc driver?
just only impl this traits(6)
use rbdc::db::{Driver, MetaData, Row, Connection, ConnectOptions, Placeholder};
pub struct YourDriver{}
impl Driver for YourDriver{}
pub struct YourMetaData{}
impl MetaData for YourMetaData{}
pub struct YourRow{}
impl Row for YourRow{}
pub struct YourConnection{}
impl Connection for YourConnection{}
pub struct YourConnectOptions{}
impl ConnectOptions for YourConnectOptions{}
pub struct YourPlaceholder{}
impl Placeholder for YourPlaceholder{}
how to use my driver?
- more examples
- for sqlite example
use rbdc_sqlite::SqliteDriver;
use rbdc::db::{Connection};
use rbdc::Error;
use rbdc::pool::ConnManager;
use rbdc::pool::Pool;
use rbdc_pool_fast::FastPool;
#[tokio::main]
async fn main() -> Result<(), Error> {
let pool = FastPool::new(ConnManager::new(SqliteDriver {}, "sqlite://target/test.db")?)?;
let mut conn = pool.get().await?;
let v = conn.get_values("select * from sqlite_master", vec![]).await?;
println!("{}", rbs::Value::Array(v));
Ok(())
}
Dependencies
~7–20MB
~314K SLoC