Trait geekorm_core::backends::GeekConnector
source · pub trait GeekConnector{
// Required methods
async fn save<'a, T>(
&mut self,
connection: impl Into<&'a T>,
) -> Result<(), Error>
where T: GeekConnection<Connection = T> + 'a;
async fn fetch<'a, T>(
&mut self,
connection: impl Into<&'a T>,
) -> Result<(), Error>
where T: GeekConnection<Connection = T> + 'a;
// Provided methods
async fn query<'a, T>(
connection: impl Into<&'a T>,
query: Query,
) -> Result<Vec<Self>, Error>
where T: GeekConnection<Connection = T> + 'a { ... }
async fn query_first<'a, T>(
connection: impl Into<&'a T>,
query: Query,
) -> Result<Self, Error>
where T: GeekConnection<Connection = T> + 'a { ... }
async fn execute<'a, T>(
connection: impl Into<&'a T>,
query: Query,
) -> Result<(), Error>
where T: GeekConnection<Connection = T> + 'a { ... }
async fn create_table<'a, T>(
connection: impl Into<&'a T>,
) -> Result<(), Error>
where T: GeekConnection<Connection = T> + 'a,
Self: Serialize { ... }
async fn row_count<'a, T>(
connection: impl Into<&'a T>,
query: Query,
) -> Result<i64, Error>
where T: GeekConnection<Connection = T> + 'a { ... }
async fn update<'a, T>(
&self,
connection: impl Into<&'a T>,
) -> Result<(), Error>
where T: GeekConnection<Connection = T> + 'a { ... }
async fn delete<'a, T>(
&self,
connection: impl Into<&'a T>,
) -> Result<(), Error>
where T: GeekConnection + 'a { ... }
async fn fetch_all<'a, T>(
connection: impl Into<&'a T>,
) -> Result<Vec<Self>, Error>
where T: GeekConnection<Connection = T> + 'a { ... }
}Expand description
GeekConnection is the trait used for models to interact with the database.
This trait is used to define the methods that are used to interact with the database.
Required Methods§
Provided Methods§
sourceasync fn query<'a, T>(
connection: impl Into<&'a T>,
query: Query,
) -> Result<Vec<Self>, Error>where
T: GeekConnection<Connection = T> + 'a,
async fn query<'a, T>(
connection: impl Into<&'a T>,
query: Query,
) -> Result<Vec<Self>, Error>where
T: GeekConnection<Connection = T> + 'a,
Query the database with an active Connection and Query
sourceasync fn query_first<'a, T>(
connection: impl Into<&'a T>,
query: Query,
) -> Result<Self, Error>where
T: GeekConnection<Connection = T> + 'a,
async fn query_first<'a, T>(
connection: impl Into<&'a T>,
query: Query,
) -> Result<Self, Error>where
T: GeekConnection<Connection = T> + 'a,
Query the first row from the database with an active Connection and Query
sourceasync fn execute<'a, T>(
connection: impl Into<&'a T>,
query: Query,
) -> Result<(), Error>where
T: GeekConnection<Connection = T> + 'a,
async fn execute<'a, T>(
connection: impl Into<&'a T>,
query: Query,
) -> Result<(), Error>where
T: GeekConnection<Connection = T> + 'a,
Execute a query on the database and do not return any rows
sourceasync fn create_table<'a, T>(connection: impl Into<&'a T>) -> Result<(), Error>where
T: GeekConnection<Connection = T> + 'a,
Self: Serialize,
async fn create_table<'a, T>(connection: impl Into<&'a T>) -> Result<(), Error>where
T: GeekConnection<Connection = T> + 'a,
Self: Serialize,
Create a table in the database
sourceasync fn row_count<'a, T>(
connection: impl Into<&'a T>,
query: Query,
) -> Result<i64, Error>where
T: GeekConnection<Connection = T> + 'a,
async fn row_count<'a, T>(
connection: impl Into<&'a T>,
query: Query,
) -> Result<i64, Error>where
T: GeekConnection<Connection = T> + 'a,
Count the number of rows based on a Query
sourceasync fn update<'a, T>(&self, connection: impl Into<&'a T>) -> Result<(), Error>where
T: GeekConnection<Connection = T> + 'a,
async fn update<'a, T>(&self, connection: impl Into<&'a T>) -> Result<(), Error>where
T: GeekConnection<Connection = T> + 'a,
Update the current object in the database
Object Safety§
This trait is not object safe.