rbdc
Database driver abstraction layer for Rust, providing a unified interface for rbatis.
Table of Contents
Features
- Safe:
#![forbid(unsafe_code)]- 100% safe Rust - Async: Native async support based on Tokio
- Extensible: Simple trait definitions for easy driver implementation
Supported Databases
| Database | Driver |
|---|---|
| MySQL | rbdc-mysql |
| PostgreSQL | rbdc-pg |
| SQLite | rbdc-sqlite |
| MSSQL | rbdc-mssql |
| Truso | rbdc-turso |
| DuckDB | rbdc-duckdb |
Quick Start
use SqliteDriver;
use FastPool;
async
Scan Utility
For memory-efficient row-by-row iteration instead of loading all rows into a Value array at once:
use Connection;
use Scan;
let rows = conn.exec_rows.await?;
let scan = new;
// Collect all rows into a Vec of struct
let activities: = scan.collect?;
Implement Custom Driver
Implement these 6 traits:
use ;
/// use your driver
async
For databases with blocking APIs, refer to rbdc-sqlite which uses the flume channel library.
See examples for more.
License
MIT