Added Postgres backend and SQLx.

This commit is contained in:
2026-09-19 22:13:38 +02:00
parent 04ebc95920
commit 15b8ae8f62
17 changed files with 1545 additions and 49 deletions
+25
View File
@@ -0,0 +1,25 @@
use axum::{
http::StatusCode,
response::{IntoResponse, Response},
};
#[derive(Debug)]
pub enum AppError {
Database(sqlx::Error),
}
impl From<sqlx::Error> for AppError {
fn from(error: sqlx::Error) -> Self {
Self::Database(error)
}
}
impl IntoResponse for AppError {
fn into_response(self) -> Response {
match self {
Self::Database(error) => tracing::error!(%error, "Database query failed"),
}
(StatusCode::INTERNAL_SERVER_ERROR, "Internal server error").into_response()
}
}