feat: add rqlite database support
This commit is contained in:
1 parent
a799958328
commit
0887b96236
34 files changed
+804
-12
No files matched your search
@@ -47,6 +47,7 @@ pub enum PoolKind {
|
||||
Mysql(db::mysql::MySqlPool, MysqlMode),
|
||||
Postgres(deadpool_postgres::Pool),
|
||||
Sqlite(db::sqlite::SqliteHandle),
|
||||
Rqlite(db::rqlite_driver::RqliteClient),
|
||||
Redis(db::redis_driver::RedisConnection),
|
||||
DuckDb(Arc<std::sync::Mutex<duckdb::Connection>>),
|
||||
MongoDb(mongodb::Client),
|
||||
@@ -343,6 +344,18 @@ impl AppState {
|
||||
db::sqlite::connect_path_with_extensions(&expand_tilde(&db_config.host), extensions).await?,
|
||||
)
|
||||
}
|
||||
DatabaseType::Rqlite => {
|
||||
let client = db::rqlite_driver::RqliteClient::new(
|
||||
&url,
|
||||
db_config.url_params.as_deref(),
|
||||
&db_config.username,
|
||||
&db_config.password,
|
||||
db_config.ssl,
|
||||
connect_timeout,
|
||||
)?;
|
||||
db::rqlite_driver::test_connection(&client, connect_timeout).await?;
|
||||
PoolKind::Rqlite(client)
|
||||
}
|
||||
DatabaseType::Redis => {
|
||||
let con = if db_config.uses_redis_cluster() {
|
||||
db::redis_driver::RedisConnection::Cluster(db::redis_driver::connect_cluster(&db_config).await?)
|
||||
@@ -919,6 +932,7 @@ pub async fn close_pool_kind(pool: PoolKind) {
|
||||
}
|
||||
PoolKind::Postgres(p) => p.close(),
|
||||
PoolKind::Sqlite(_) => {}
|
||||
PoolKind::Rqlite(_) => {}
|
||||
PoolKind::Redis(_) => {}
|
||||
PoolKind::DuckDb(con) => {
|
||||
crate::db::duckdb_driver::close_connection(con);
|
||||
|
||||
Reference in new issue
Block a user