Skip to main content

Model

Trait Model 

Source
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§

Source

fn new() -> Self

Source

async fn schema_view(&self, _pool: &Pool<Postgres>) -> SchemaView

Provided Methods§

Source

fn keyword(&self) -> String

Source

fn push_filter_conditions<'args>( &self, _qb: &mut QueryBuilder<'args, Postgres>, _filters: &HashMap<String, String>, ) -> Result<(), Error>

Source

fn push_conditions<'args>( &self, qb: &mut QueryBuilder<'args, Postgres>, params: &ModelListParams, ) -> Result<(), Error>

Source

async fn insert( &self, _pool: &Pool<Postgres>, _params: Value, ) -> Result<u64, Error>

Source

async fn get_by_id( &self, _pool: &Pool<Postgres>, _id: u64, ) -> Result<Option<Self::Output>, Error>

Source

async fn delete_by_id( &self, _pool: &Pool<Postgres>, _id: u64, ) -> Result<(), Error>

Source

async fn update_by_id( &self, _pool: &Pool<Postgres>, _id: u64, _params: Value, ) -> Result<(), Error>

Source

async fn count( &self, _pool: &Pool<Postgres>, _params: &ModelListParams, ) -> Result<i64, Error>

Source

async fn list( &self, _pool: &Pool<Postgres>, _params: &ModelListParams, ) -> Result<Vec<Self::Output>, Error>

Source

async fn list_and_count( &self, pool: &Pool<Postgres>, count: bool, params: &ModelListParams, ) -> Result<Value, Error>

Source

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.

Implementors§