pub struct Db {
pub pool: Pool<PostgresConnectionManager<NoTls>>,
}
Fields§
§pool: Pool<PostgresConnectionManager<NoTls>>
Implementations§
Trait Implementations§
Source§impl<T: RestModel> DbClient<T> for Db
impl<T: RestModel> DbClient<T> for Db
fn generate_id(&self) -> String
async fn init(&self, db_name: &str, table_name: &str) -> Result<(), Error>
Source§async fn select_by_id(
&self,
db_name: &str,
table_name: &str,
id: &str,
) -> Result<Doc<T>>
async fn select_by_id( &self, db_name: &str, table_name: &str, id: &str, ) -> Result<Doc<T>>
GET /resources/:id
Source§async fn paginate(
&self,
db_name: &str,
table_name: &str,
pagination_params: &PaginationParams,
) -> Result<PaginationResult<T>>
async fn paginate( &self, db_name: &str, table_name: &str, pagination_params: &PaginationParams, ) -> Result<PaginationResult<T>>
GET /resources
Source§async fn upsert(
&self,
db_name: &str,
table_name: &str,
items: Vec<Doc<T>>,
) -> Result<UpsertResult>
async fn upsert( &self, db_name: &str, table_name: &str, items: Vec<Doc<T>>, ) -> Result<UpsertResult>
PUT /resources
Source§async fn update(
&self,
db_name: &str,
table_name: &str,
params: &PatchParams,
) -> Result<UpdateResult>
async fn update( &self, db_name: &str, table_name: &str, params: &PatchParams, ) -> Result<UpdateResult>
PATCH /resources
Source§async fn delete(
&self,
db_name: &str,
table_name: &str,
params: &DeleteParams,
) -> Result<DeleteResult>
async fn delete( &self, db_name: &str, table_name: &str, params: &DeleteParams, ) -> Result<DeleteResult>
DELETE /resources
Auto Trait Implementations§
impl Freeze for Db
impl !RefUnwindSafe for Db
impl Send for Db
impl Sync for Db
impl Unpin for Db
impl !UnwindSafe for Db
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more