Trait ormx::Table [−][src]
pub trait Table where
Self: Sized + Send + Sync + 'static, {
type Id: 'static + Copy + Send;
fn id(&self) -> Self::Id;
fn get<'a, 'c: 'a>(
db: impl Executor<'c, Database = Db> + 'a,
id: Self::Id
) -> BoxFuture<'a, Result<Self>>;
fn stream_all<'a, 'c: 'a>(
db: impl Executor<'c, Database = Db> + 'a
) -> BoxStream<'a, Result<Self>>;
fn stream_all_paginated<'a, 'c: 'a>(
db: impl Executor<'c, Database = Db> + 'a,
offset: i64,
limit: i64
) -> BoxStream<'a, Result<Self>>;
fn update<'a, 'c: 'a>(
&'a self,
db: impl Executor<'c, Database = Db> + 'a
) -> BoxFuture<'a, Result<()>>;
fn insert(
db: &mut <Db as Database>::Connection,
row: impl Insert<Table = Self>
) -> BoxFuture<'_, Result<Self>> { ... }
fn all<'a, 'c: 'a>(
db: impl Executor<'c, Database = Db> + 'a
) -> BoxFuture<'a, Result<Vec<Self>>> { ... }
fn all_paginated<'a, 'c: 'a>(
db: impl Executor<'c, Database = Db> + 'a,
offset: i64,
limit: i64
) -> BoxFuture<'a, Result<Vec<Self>>> { ... }
fn patch<'a, 'c: 'a, P>(
&'a mut self,
db: impl Executor<'c, Database = Db> + 'a,
patch: P
) -> BoxFuture<'a, Result<()>>
where
P: Patch<Table = Self>,
{ ... }
fn reload<'a, 'c: 'a>(
&'a mut self,
db: impl Executor<'c, Database = Db> + 'a
) -> BoxFuture<'a, Result<()>> { ... }
}
Expand description
A database table in which each row is identified by a unique ID.
Associated Types
Required methods
Queries the row of the given id.
fn stream_all<'a, 'c: 'a>(
db: impl Executor<'c, Database = Db> + 'a
) -> BoxStream<'a, Result<Self>>
fn stream_all<'a, 'c: 'a>(
db: impl Executor<'c, Database = Db> + 'a
) -> BoxStream<'a, Result<Self>>
Stream all rows from this table.
fn stream_all_paginated<'a, 'c: 'a>(
db: impl Executor<'c, Database = Db> + 'a,
offset: i64,
limit: i64
) -> BoxStream<'a, Result<Self>>
Provided methods
Insert a row into the database.
Load all rows from this table.
fn all_paginated<'a, 'c: 'a>(
db: impl Executor<'c, Database = Db> + 'a,
offset: i64,
limit: i64
) -> BoxFuture<'a, Result<Vec<Self>>>
Applies a patch to this row.