mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-07 18:07:47 +08:00
refactor: extract runtime state backends
This commit is contained in:
@@ -4,10 +4,6 @@ pub(crate) fn postgres_error(error: impl std::fmt::Display) -> DataLayerError {
|
||||
DataLayerError::postgres(error)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
@@ -22,16 +18,6 @@ impl<T> SqlxResultExt<T> for Result<T, sqlx::Error> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) trait RedisResultExt<T> {
|
||||
fn map_redis_err(self) -> Result<T, DataLayerError>;
|
||||
}
|
||||
|
||||
impl<T> RedisResultExt<T> for Result<T, redis::RedisError> {
|
||||
fn map_redis_err(self) -> Result<T, DataLayerError> {
|
||||
self.map_err(redis_error)
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) trait SqlResultExt<T> {
|
||||
fn map_sql_err(self) -> Result<T, DataLayerError>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user