pub trait Model: Send + Sync {
type Output: Serialize;
Show 13 methods
// Required methods
fn new() -> Self;
async fn schema_view(&self, _pool: &Pool<Postgres>) -> SchemaView;
// Provided methods
fn keyword(&self) -> String { ... }
fn push_filter_conditions<'args>(
&self,
_qb: &mut QueryBuilder<'args, Postgres>,
_filters: &HashMap<String, String>,
) -> Result<(), Error> { ... }
fn push_conditions<'args>(
&self,
qb: &mut QueryBuilder<'args, Postgres>,
params: &ModelListParams,
) -> Result<(), Error> { ... }
async fn insert(
&self,
_pool: &Pool<Postgres>,
_params: Value,
) -> Result<u64, Error> { ... }
async fn get_by_id(
&self,
_pool: &Pool<Postgres>,
_id: u64,
) -> Result<Option<Self::Output>, Error> { ... }
async fn delete_by_id(
&self,
_pool: &Pool<Postgres>,
_id: u64,
) -> Result<(), Error> { ... }
async fn update_by_id(
&self,
_pool: &Pool<Postgres>,
_id: u64,
_params: Value,
) -> Result<(), Error> { ... }
async fn count(
&self,
_pool: &Pool<Postgres>,
_params: &ModelListParams,
) -> Result<i64, Error> { ... }
async fn list(
&self,
_pool: &Pool<Postgres>,
_params: &ModelListParams,
) -> Result<Vec<Self::Output>, Error> { ... }
async fn list_and_count(
&self,
pool: &Pool<Postgres>,
count: bool,
params: &ModelListParams,
) -> Result<Value, Error> { ... }
async fn search_options(
&self,
_pool: &Pool<Postgres>,
_keyword: Option<String>,
) -> Result<Vec<SchemaOption>, Error> { ... }
}Required Associated Types§
Required Methods§
fn new() -> Self
async fn schema_view(&self, _pool: &Pool<Postgres>) -> SchemaView
Provided Methods§
fn keyword(&self) -> String
fn push_filter_conditions<'args>( &self, _qb: &mut QueryBuilder<'args, Postgres>, _filters: &HashMap<String, String>, ) -> Result<(), Error>
fn push_conditions<'args>( &self, qb: &mut QueryBuilder<'args, Postgres>, params: &ModelListParams, ) -> Result<(), Error>
async fn insert( &self, _pool: &Pool<Postgres>, _params: Value, ) -> Result<u64, Error>
async fn get_by_id( &self, _pool: &Pool<Postgres>, _id: u64, ) -> Result<Option<Self::Output>, Error>
async fn delete_by_id( &self, _pool: &Pool<Postgres>, _id: u64, ) -> Result<(), Error>
async fn update_by_id( &self, _pool: &Pool<Postgres>, _id: u64, _params: Value, ) -> Result<(), Error>
async fn count( &self, _pool: &Pool<Postgres>, _params: &ModelListParams, ) -> Result<i64, Error>
async fn list( &self, _pool: &Pool<Postgres>, _params: &ModelListParams, ) -> Result<Vec<Self::Output>, Error>
async fn list_and_count( &self, pool: &Pool<Postgres>, count: bool, params: &ModelListParams, ) -> Result<Value, Error>
async fn search_options( &self, _pool: &Pool<Postgres>, _keyword: Option<String>, ) -> Result<Vec<SchemaOption>, 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.