pub mod accounts; pub use gejdr_macros::Crud; pub trait Crud { /// Find the entiy in the database based on its identifier. /// /// # Errors /// Returns any error Postgres may have encountered fn find( pool: &sqlx::PgPool, id: &Id, ) -> impl std::future::Future>> + Send where Self: Sized; /// Create the entity in the database. /// /// # Errors /// Returns any error Postgres may have encountered fn create( &self, pool: &sqlx::PgPool, ) -> impl std::future::Future> + Send where Self: Sized; /// Update an entity with a matching identifier in the database. /// /// # Errors /// Returns any error Postgres may have encountered fn update( &self, pool: &sqlx::PgPool, ) -> impl std::future::Future> + Send where Self: Sized; /// Update an entity with a matching identifier in the database if /// it exists, create it otherwise. /// /// # Errors /// Returns any error Postgres may have encountered fn create_or_update( &self, pool: &sqlx::PgPool, ) -> impl std::future::Future> + Send where Self: Sized; /// Delete the entity from the database if it exists. /// /// # Returns /// Returns the amount of rows affected by the deletion. /// /// # Errors /// Returns any error Postgres may have encountered fn delete( &self, pool: &sqlx::PgPool, ) -> impl std::future::Future> + Send; /// Delete any entity with the identifier `id`. /// /// # Returns /// Returns the amount of rows affected by the deletion. /// /// # Errors /// Returns any error Postgres may have encountered fn delete_by_id( pool: &sqlx::PgPool, id: &Id, ) -> impl std::future::Future> + Send; }