[][src]Trait mongodb_base_service::BaseService

pub trait BaseService<'a> {
    fn new(collection: &Collection, default_sort: Option<Document>) -> Self;
fn data_source(&self) -> &Collection; fn id_parameter(&self) -> &'static str { ... }
fn default_sort(&self) -> Document { ... }
fn default_filter(&self) -> Option<&Document> { ... }
fn default_limit(&self) -> i64 { ... }
fn generate_id(&self) -> Option<String> { ... }
fn find<T>(
        &self,
        filter: Option<Document>,
        sort: Option<Document>,
        limit: Option<i32>,
        after: Option<String>,
        before: Option<String>,
        skip: Option<i32>
    ) -> Result<FindResult<T>, ServiceError>
    where
        T: Deserialize<'a>
, { ... }
fn get_embedded_by_id<U>(
        &self,
        id: ID,
        field: &str,
        limit: Option<i32>,
        skip: Option<i32>
    ) -> Result<Vec<U>, ServiceError>
    where
        U: Deserialize<'a>
, { ... }
fn search<T>(
        &self,
        search_term: String,
        fields: Vec<String>,
        sort: Option<Document>,
        limit: Option<i32>,
        after: Option<String>,
        before: Option<String>,
        skip: Option<i32>
    ) -> Result<FindResult<T>, ServiceError>
    where
        T: Deserialize<'a>
, { ... }
fn find_one<T>(&self, filter: Document) -> Result<Option<T>, ServiceError>
    where
        T: Deserialize<'a>
, { ... }
fn find_one_by_object_id<T>(
        &self,
        field: &str,
        value: ObjectId
    ) -> Result<Option<T>, ServiceError>
    where
        T: Deserialize<'a>
, { ... }
fn find_one_by_id<T>(&self, id: ID) -> Result<Option<T>, ServiceError>
    where
        T: Deserialize<'a>
, { ... }
fn find_one_by_string_value<T>(
        &self,
        field: &str,
        value: &str
    ) -> Result<Option<T>, ServiceError>
    where
        T: Deserialize<'a>
, { ... }
fn find_one_by_i64<T>(
        &self,
        field: &str,
        value: i64
    ) -> Result<Option<T>, ServiceError>
    where
        T: Deserialize<'a>
, { ... }
fn insert_embedded<T>(
        &self,
        id: ID,
        field_path: &str,
        new_items: Vec<T>,
        user_id: Option<ID>
    ) -> Result<Vec<ID>, ServiceError>
    where
        T: Serialize
, { ... }
fn upsert_embedded<T, U>(
        &self,
        id: ID,
        field_path: &str,
        new_items: Vec<T>,
        user_id: Option<ID>,
        parent: Option<U>
    ) -> Result<Vec<ID>, ServiceError>
    where
        T: Serialize,
        U: Serialize
, { ... }
fn insert_one<T>(
        &self,
        new_item: T,
        user_id: Option<ID>
    ) -> Result<ID, ServiceError>
    where
        T: Serialize
, { ... }
fn insert_many<T>(
        &self,
        new_items: Vec<T>,
        user_id: Option<ID>
    ) -> Result<Vec<ID>, ServiceError>
    where
        T: Serialize
, { ... }
fn delete_one_by_id(&self, id: ID) -> Result<DeleteResponse, ServiceError> { ... }
fn delete_one_by_query(
        &self,
        filter: Document
    ) -> Result<bool, ServiceError> { ... }
fn delete_embedded(
        &self,
        id: ID,
        field_path: &str,
        embedded_id: ID
    ) -> Result<DeleteResponse, ServiceError> { ... }
fn update_embedded<T, U>(
        &self,
        id: ID,
        field_path: &str,
        embedded_id: ID,
        update_item: T,
        user_id: Option<ID>
    ) -> Result<U, ServiceError>
    where
        T: Serialize,
        U: Deserialize<'a>
, { ... }
fn update_one<T, U>(
        &self,
        id: ID,
        update_item: T,
        user_id: Option<ID>
    ) -> Result<U, ServiceError>
    where
        T: Serialize,
        U: Deserialize<'a> + Node
, { ... }
fn update_one_with_doc<U>(
        &self,
        id: ID,
        update_doc: Document
    ) -> Result<U, ServiceError>
    where
        U: Deserialize<'a>
, { ... } }

Required methods

fn new(collection: &Collection, default_sort: Option<Document>) -> Self

fn data_source(&self) -> &Collection

Loading content...

Provided methods

fn id_parameter(&self) -> &'static str

fn default_sort(&self) -> Document

fn default_filter(&self) -> Option<&Document>

fn default_limit(&self) -> i64

fn generate_id(&self) -> Option<String>

fn find<T>(
    &self,
    filter: Option<Document>,
    sort: Option<Document>,
    limit: Option<i32>,
    after: Option<String>,
    before: Option<String>,
    skip: Option<i32>
) -> Result<FindResult<T>, ServiceError> where
    T: Deserialize<'a>, 

fn get_embedded_by_id<U>(
    &self,
    id: ID,
    field: &str,
    limit: Option<i32>,
    skip: Option<i32>
) -> Result<Vec<U>, ServiceError> where
    U: Deserialize<'a>, 

fn search<T>(
    &self,
    search_term: String,
    fields: Vec<String>,
    sort: Option<Document>,
    limit: Option<i32>,
    after: Option<String>,
    before: Option<String>,
    skip: Option<i32>
) -> Result<FindResult<T>, ServiceError> where
    T: Deserialize<'a>, 

fn find_one<T>(&self, filter: Document) -> Result<Option<T>, ServiceError> where
    T: Deserialize<'a>, 

fn find_one_by_object_id<T>(
    &self,
    field: &str,
    value: ObjectId
) -> Result<Option<T>, ServiceError> where
    T: Deserialize<'a>, 

fn find_one_by_id<T>(&self, id: ID) -> Result<Option<T>, ServiceError> where
    T: Deserialize<'a>, 

fn find_one_by_string_value<T>(
    &self,
    field: &str,
    value: &str
) -> Result<Option<T>, ServiceError> where
    T: Deserialize<'a>, 

fn find_one_by_i64<T>(
    &self,
    field: &str,
    value: i64
) -> Result<Option<T>, ServiceError> where
    T: Deserialize<'a>, 

fn insert_embedded<T>(
    &self,
    id: ID,
    field_path: &str,
    new_items: Vec<T>,
    user_id: Option<ID>
) -> Result<Vec<ID>, ServiceError> where
    T: Serialize

fn upsert_embedded<T, U>(
    &self,
    id: ID,
    field_path: &str,
    new_items: Vec<T>,
    user_id: Option<ID>,
    parent: Option<U>
) -> Result<Vec<ID>, ServiceError> where
    T: Serialize,
    U: Serialize

fn insert_one<T>(
    &self,
    new_item: T,
    user_id: Option<ID>
) -> Result<ID, ServiceError> where
    T: Serialize

fn insert_many<T>(
    &self,
    new_items: Vec<T>,
    user_id: Option<ID>
) -> Result<Vec<ID>, ServiceError> where
    T: Serialize

fn delete_one_by_id(&self, id: ID) -> Result<DeleteResponse, ServiceError>

fn delete_one_by_query(&self, filter: Document) -> Result<bool, ServiceError>

fn delete_embedded(
    &self,
    id: ID,
    field_path: &str,
    embedded_id: ID
) -> Result<DeleteResponse, ServiceError>

fn update_embedded<T, U>(
    &self,
    id: ID,
    field_path: &str,
    embedded_id: ID,
    update_item: T,
    user_id: Option<ID>
) -> Result<U, ServiceError> where
    T: Serialize,
    U: Deserialize<'a>, 

fn update_one<T, U>(
    &self,
    id: ID,
    update_item: T,
    user_id: Option<ID>
) -> Result<U, ServiceError> where
    T: Serialize,
    U: Deserialize<'a> + Node

fn update_one_with_doc<U>(
    &self,
    id: ID,
    update_doc: Document
) -> Result<U, ServiceError> where
    U: Deserialize<'a>, 

Loading content...

Implementors

Loading content...