Trait DbClient

Source
pub trait DbClient<T>: Sync
where T: RestModel,
{ // Required methods fn generate_id(&self) -> String; fn init( &self, db_name: &str, table_name: &str, ) -> impl Future<Output = Result<(), Error>>; fn select_by_id( &self, db_name: &str, table_name: &str, id: &str, ) -> impl Future<Output = Result<Doc<T>, Error>>; fn paginate( &self, db_name: &str, table_name: &str, pagination_params: &PaginationParams, ) -> impl Future<Output = Result<PaginationResult<T>, Error>>; fn upsert( &self, db_name: &str, table_name: &str, items: &[Doc<T>], ) -> impl Future<Output = Result<UpsertResult, Error>>; fn update( &self, db_name: &str, table_name: &str, params: &PatchParams, ) -> impl Future<Output = Result<UpdateResult, Error>>; fn delete( &self, db_name: &str, table_name: &str, filter: &DeleteParams, ) -> impl Future<Output = Result<DeleteResult, Error>>; }

Required Methods§

Source

fn generate_id(&self) -> String

Source

fn init( &self, db_name: &str, table_name: &str, ) -> impl Future<Output = Result<(), Error>>

Source

fn select_by_id( &self, db_name: &str, table_name: &str, id: &str, ) -> impl Future<Output = Result<Doc<T>, Error>>

GET /resources/:id

Source

fn paginate( &self, db_name: &str, table_name: &str, pagination_params: &PaginationParams, ) -> impl Future<Output = Result<PaginationResult<T>, Error>>

GET /resources

Source

fn upsert( &self, db_name: &str, table_name: &str, items: &[Doc<T>], ) -> impl Future<Output = Result<UpsertResult, Error>>

PUT /resources

Source

fn update( &self, db_name: &str, table_name: &str, params: &PatchParams, ) -> impl Future<Output = Result<UpdateResult, Error>>

PATCH /resources

Source

fn delete( &self, db_name: &str, table_name: &str, filter: &DeleteParams, ) -> impl Future<Output = Result<DeleteResult, Error>>

DELETE /resources

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§