StreamableEntity

Trait StreamableEntity 

Source
pub trait StreamableEntity: Sized {
    // Required method
    fn stream<'a>(
        executor: impl PgExecutor<'a> + 'a,
    ) -> impl Stream<Item = Result<Self, Error>>;
}
Expand description

Trait for types that can be streamed (selected) from the database. This trait is implemented for the entity struct, allowing you to stream all rows from the table.

Required Methods§

Source

fn stream<'a>( executor: impl PgExecutor<'a> + 'a, ) -> impl Stream<Item = Result<Self, Error>>

Stream all entities from the database table.

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

An async stream of results, each being either the 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§