Trait UpdatableEntity

Source
pub trait UpdatableEntity {
    type SourceEntity;

    // Required method
    fn update<'a>(
        &self,
        executor: impl PgExecutor<'a>,
    ) -> impl Future<Output = Result<Self::SourceEntity, Error>>;
}
Expand description

Trait for types that can be updated in the database. An “Updatable” struct is generated for each entity, containing the primary key(s) and updatable fields.

Required Associated Types§

Source

type SourceEntity

The entity type returned after updating (typically the main entity struct).

Required Methods§

Source

fn update<'a>( &self, executor: impl PgExecutor<'a>, ) -> impl Future<Output = Result<Self::SourceEntity, Error>>

Update the entity in the database.

§Arguments
  • pool - A reference to a PostgreSQL connection pool.
§Returns

A future resolving to either the updated entity or a SQLx error.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§