mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-07 01:47:47 +08:00
refactor(workspace): enforce layered crate boundaries
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
use crate::DataLayerError;
|
||||
|
||||
pub(crate) fn postgres_error(error: impl std::fmt::Display) -> DataLayerError {
|
||||
DataLayerError::postgres(error)
|
||||
}
|
||||
|
||||
pub(crate) trait SqlxResultExt<T> {
|
||||
fn map_postgres_err(self) -> Result<T, DataLayerError>;
|
||||
}
|
||||
|
||||
impl<T> SqlxResultExt<T> for Result<T, sqlx::Error> {
|
||||
fn map_postgres_err(self) -> Result<T, DataLayerError> {
|
||||
self.map_err(postgres_error)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user