add liegenschaft
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
use anyhow::Error;
|
||||
|
||||
use super::Repository;
|
||||
use crate::{database::Queryer, domain::liegenschaft::model, scalar::Id};
|
||||
|
||||
impl Repository {
|
||||
pub async fn liegenschaft_zeige_einen<'c, C: Queryer<'c>>(
|
||||
&self,
|
||||
db: C,
|
||||
id: Id,
|
||||
) -> Result<model::Liegenschaft, Error> {
|
||||
const QUERY: &str = r#"
|
||||
SELECT id, erstellt_am, geaendert_am, liegenschaftname
|
||||
FROM liegenschaften
|
||||
WHERE id = $1
|
||||
"#;
|
||||
|
||||
let row = sqlx::query_as::<_, model::Liegenschaft>(QUERY)
|
||||
.bind(id)
|
||||
.fetch_one(db)
|
||||
.await?;
|
||||
|
||||
Ok(row)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user