mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-07 18:07:47 +08:00
Add multi-database data layer
Introduce aether-data-schema and driver-specific schema generation for Postgres, MySQL, and SQLite. Split data backends, lifecycle, repositories, and gateway runtime integration across database drivers. Verified with cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, and cargo test --workspace.
This commit is contained in:
@@ -8,6 +8,10 @@ pub(crate) fn redis_error(error: impl std::fmt::Display) -> DataLayerError {
|
||||
DataLayerError::redis(error)
|
||||
}
|
||||
|
||||
pub(crate) fn sql_error(error: impl std::fmt::Display) -> DataLayerError {
|
||||
DataLayerError::sql(error)
|
||||
}
|
||||
|
||||
pub(crate) trait SqlxResultExt<T> {
|
||||
fn map_postgres_err(self) -> Result<T, DataLayerError>;
|
||||
}
|
||||
@@ -27,3 +31,13 @@ impl<T> RedisResultExt<T> for Result<T, redis::RedisError> {
|
||||
self.map_err(redis_error)
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) trait SqlResultExt<T> {
|
||||
fn map_sql_err(self) -> Result<T, DataLayerError>;
|
||||
}
|
||||
|
||||
impl<T> SqlResultExt<T> for Result<T, sqlx::Error> {
|
||||
fn map_sql_err(self) -> Result<T, DataLayerError> {
|
||||
self.map_err(sql_error)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user