SZ-ORM sqlx adapter
Provides Connection and ConnectionFactory implementations for sz-orm-core, supporting MySQL, PostgreSQL, and SQLite.
Does not use sqlx::Any; instead implements each backend separately to avoid type limitations and lifetime issues.
Examples
use sz_orm_core::{Pool, PoolConfigBuilder};
use sz_orm_sqlx::{SqlitePoolHandle, SqlxSqliteConnectionFactory};
use std::sync::Arc;
# #[tokio::main]
# async fn main() -> Result<(), Box<dyn std::error::Error>> {
let pool_handle = SqlitePoolHandle::connect("sqlite::memory:").await?;
let factory = Arc::new(SqlxSqliteConnectionFactory::new(Arc::new(pool_handle)));
let config = PoolConfigBuilder::new().max_size(10).build()?;
let pool = Pool::new(config, factory)?;
let mut conn = pool.acquire().await?;
let rows = conn.query("SELECT 1 as one").await?;
assert_eq!(rows.len(), 1);
# Ok(())
# }