feat: deprecate create_or_update in favour of upsert

The `create_or_update` method has been deprecated and replaced by
`upsert` for clarity and consistency with common database terminology.

This commit also removes the file `src/entity.rs` which has been
forgotten in earlier commits and was no longer part of Georm.
This commit is contained in:
2025-08-09 15:09:22 +02:00
parent 49c7d86102
commit 5d8a1b1917
10 changed files with 25 additions and 100 deletions

View File

@@ -58,7 +58,7 @@ impl Profile {
&mut self,
display_name: Option<String>,
bio: Option<String>,
executor: E
executor: E,
) -> Result<Self>
where
E: sqlx::Executor<'e, Database = sqlx::Postgres>,

View File

@@ -69,7 +69,7 @@ impl User {
pub async fn get_user_by_id_or_select<'e, E>(
id: Option<i32>,
prompt: &str,
executor: E
executor: E,
) -> Result<Self>
where
E: sqlx::Executor<'e, Database = sqlx::Postgres>,
@@ -128,8 +128,7 @@ impl User {
Ok(user)
}
pub async fn update_profile(id: Option<i32>, pool: &sqlx::PgPool) -> Result<(User, Profile)>
{
pub async fn update_profile(id: Option<i32>, pool: &sqlx::PgPool) -> Result<(User, Profile)> {
let prompt = "Select the user whose profile you want to update";
let user = Self::get_user_by_id_or_select(id, prompt, pool).await?;
let profile = match user.get_profile(pool).await? {