Trait goatns::db::DBEntity

source ·
pub trait DBEntity: Send {
    const TABLE: &'static str;
Show 13 methods // Required methods fn create_table<'life0, 'async_trait>( pool: &'life0 SqlitePool ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait; fn get<'life0, 'async_trait>( pool: &'life0 Pool<Sqlite>, id: i64 ) -> Pin<Box<dyn Future<Output = Result<Box<Self>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_with_txn<'t, 'life0, 'life1, 'async_trait>( _txn: &'life0 mut SqliteConnection, _id: &'life1 i64 ) -> Pin<Box<dyn Future<Output = Result<Box<Self>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 't: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_by_name<'t, 'life0, 'life1, 'async_trait>( txn: &'life0 mut SqliteConnection, name: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<Box<Self>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 't: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_all_by_name<'t, 'life0, 'life1, 'async_trait>( txn: &'life0 mut SqliteConnection, name: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<Vec<Box<Self>>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 't: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_all_user<'life0, 'async_trait>( pool: &'life0 Pool<Sqlite>, id: i64 ) -> Pin<Box<dyn Future<Output = Result<Vec<Arc<Self>>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn save<'life0, 'life1, 'async_trait>( &'life0 self, pool: &'life1 Pool<Sqlite> ) -> Pin<Box<dyn Future<Output = Result<Box<Self>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn save_with_txn<'t, 'life0, 'life1, 'async_trait>( &'life0 self, txn: &'life1 mut SqliteConnection ) -> Pin<Box<dyn Future<Output = Result<Box<Self>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 't: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn create_with_txn<'t, 'life0, 'life1, 'async_trait>( &'life0 self, txn: &'life1 mut SqliteConnection ) -> Pin<Box<dyn Future<Output = Result<Box<Self>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 't: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn update_with_txn<'t, 'life0, 'life1, 'async_trait>( &'life0 self, txn: &'life1 mut SqliteConnection ) -> Pin<Box<dyn Future<Output = Result<Box<Self>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 't: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn delete<'life0, 'life1, 'async_trait>( &'life0 self, pool: &'life1 Pool<Sqlite> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn delete_with_txn<'life0, 'life1, 'async_trait>( &'life0 self, txn: &'life1 mut SqliteConnection ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; // Provided method fn json(&self) -> Result<String, String> where Self: Serialize { ... }
}

Required Associated Constants§

source

const TABLE: &'static str

Required Methods§

source

fn create_table<'life0, 'async_trait>( pool: &'life0 SqlitePool ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,

source

fn get<'life0, 'async_trait>( pool: &'life0 Pool<Sqlite>, id: i64 ) -> Pin<Box<dyn Future<Output = Result<Box<Self>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the entity

source

fn get_with_txn<'t, 'life0, 'life1, 'async_trait>( _txn: &'life0 mut SqliteConnection, _id: &'life1 i64 ) -> Pin<Box<dyn Future<Output = Result<Box<Self>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 't: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn get_by_name<'t, 'life0, 'life1, 'async_trait>( txn: &'life0 mut SqliteConnection, name: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<Box<Self>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 't: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn get_all_by_name<'t, 'life0, 'life1, 'async_trait>( txn: &'life0 mut SqliteConnection, name: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<Vec<Box<Self>>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 't: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn get_all_user<'life0, 'async_trait>( pool: &'life0 Pool<Sqlite>, id: i64 ) -> Pin<Box<dyn Future<Output = Result<Vec<Arc<Self>>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn save<'life0, 'life1, 'async_trait>( &'life0 self, pool: &'life1 Pool<Sqlite> ) -> Pin<Box<dyn Future<Output = Result<Box<Self>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

save the entity to the database

source

fn save_with_txn<'t, 'life0, 'life1, 'async_trait>( &'life0 self, txn: &'life1 mut SqliteConnection ) -> Pin<Box<dyn Future<Output = Result<Box<Self>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 't: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

save the entity to the database, but you’re in a transaction

source

fn create_with_txn<'t, 'life0, 'life1, 'async_trait>( &'life0 self, txn: &'life1 mut SqliteConnection ) -> Pin<Box<dyn Future<Output = Result<Box<Self>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 't: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

create from scratch

source

fn update_with_txn<'t, 'life0, 'life1, 'async_trait>( &'life0 self, txn: &'life1 mut SqliteConnection ) -> Pin<Box<dyn Future<Output = Result<Box<Self>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 't: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

create from scratch

source

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, pool: &'life1 Pool<Sqlite> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

delete the entity from the database

source

fn delete_with_txn<'life0, 'life1, 'async_trait>( &'life0 self, txn: &'life1 mut SqliteConnection ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

delete the entity from the database, but you’re in a transaction

Provided Methods§

source

fn json(&self) -> Result<String, String>
where Self: Serialize,

Object Safety§

This trait is not object safe.

Implementors§

source§

impl DBEntity for FileZone

source§

const TABLE: &'static str = "zones"

source§

impl DBEntity for FileZoneRecord

source§

const TABLE: &'static str = "records"

source§

impl DBEntity for User

source§

const TABLE: &'static str = "users"

source§

impl DBEntity for UserAuthToken

source§

const TABLE: &'static str = "user_tokens"

source§

impl DBEntity for ZoneOwnership

source§

const TABLE: &'static str = "ownership"