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 delete_row<'a, 'c: 'a>(
        db: impl Executor<'c, Database = Db> + 'a,
        id: Self::Id
    ) -> 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<()>> { ... }
fn delete<'a, 'c: 'a>(
        self,
        db: impl Executor<'c, Database = Db> + 'a
    ) -> BoxFuture<'a, Result<()>> { ... } }

A database table in which each row is identified by a unique ID.

Associated Types

type Id: 'static + Copy + Send[src]

Type of the ID column of this table.

Loading content...

Required methods

fn id(&self) -> Self::Id[src]

Returns the id of this row.

fn get<'a, 'c: 'a>(
    db: impl Executor<'c, Database = Db> + 'a,
    id: Self::Id
) -> BoxFuture<'a, Result<Self>>
[src]

Queries the row of the given id.

fn stream_all<'a, 'c: 'a>(
    db: impl Executor<'c, Database = Db> + 'a
) -> BoxStream<'a, Result<Self>>
[src]

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>>
[src]

fn update<'a, 'c: 'a>(
    &'a self,
    db: impl Executor<'c, Database = Db> + 'a
) -> BoxFuture<'a, Result<()>>
[src]

Updates all fields of this row, regardless if they have been changed or not.

fn delete_row<'a, 'c: 'a>(
    db: impl Executor<'c, Database = Db> + 'a,
    id: Self::Id
) -> BoxFuture<'a, Result<()>>
[src]

Delete a row from the database

Loading content...

Provided methods

fn insert(
    db: &mut <Db as Database>::Connection,
    row: impl Insert<Table = Self>
) -> BoxFuture<'_, Result<Self>>
[src]

Insert a row into the database.

fn all<'a, 'c: 'a>(
    db: impl Executor<'c, Database = Db> + 'a
) -> BoxFuture<'a, Result<Vec<Self>>>
[src]

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>>>
[src]

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>, 
[src]

Applies a patch to this row.

fn reload<'a, 'c: 'a>(
    &'a mut self,
    db: impl Executor<'c, Database = Db> + 'a
) -> BoxFuture<'a, Result<()>>
[src]

fn delete<'a, 'c: 'a>(
    self,
    db: impl Executor<'c, Database = Db> + 'a
) -> BoxFuture<'a, Result<()>>
[src]

Deletes this row from the database.

Loading content...

Implementors

Loading content...