pub struct DatastoreClient { /* private fields */ }
Expand description
A client for interacting with the datastore service.
Implementations§
Source§impl DatastoreClient
impl DatastoreClient
Sourcepub async fn new(config: DatastoreConfig) -> Result<Self, Error>
pub async fn new(config: DatastoreConfig) -> Result<Self, Error>
Creates a new instance of DatastoreClient
.
§Arguments
config
- The configuration settings for connecting to the datastore.
Sourcepub async fn login(
&mut self,
request: LoginRequest,
) -> Result<LoginResponse, Error>
pub async fn login( &mut self, request: LoginRequest, ) -> Result<LoginResponse, Error>
Sourcepub async fn batch_create(
&mut self,
request: BatchCreateRequest,
token: &str,
) -> Result<ResponseData, Error>
pub async fn batch_create( &mut self, request: BatchCreateRequest, token: &str, ) -> Result<ResponseData, Error>
Creates multiple records in the datastore with the provided request.
§Arguments
request
- The batch create request containing the records to be created.token
- The authorization token to authorize the request.
§Returns
Ok(ResponseData)
- The response data containing the result of the operation.Err(Error)
- If the operation fails or if an error occurs during the process.
Sourcepub async fn create(
&mut self,
request: CreateRequest,
token: &str,
) -> Result<ResponseData, Error>
pub async fn create( &mut self, request: CreateRequest, token: &str, ) -> Result<ResponseData, Error>
Creates a single record in the datastore with the provided request.
§Arguments
request
- The create request containing the record to be created.token
- The authorization token to authorize the request.
§Returns
Ok(ResponseData)
- The response data containing the result of the operation.Err(Error)
- If the operation fails or if an error occurs during the process.
Sourcepub async fn delete(
&mut self,
request: DeleteRequest,
token: &str,
) -> Result<ResponseData, Error>
pub async fn delete( &mut self, request: DeleteRequest, token: &str, ) -> Result<ResponseData, Error>
Deletes a record from the datastore with the provided request.
§Arguments
request
- The delete request containing the identifier of the record to be deleted.token
- The authorization token to authorize the request.
§Returns
Ok(ResponseData)
- The response data containing the result of the operation.Err(Error)
- If the operation fails or if an error occurs during the process.
Sourcepub async fn batch_delete(
&mut self,
request: BatchDeleteRequest,
token: &str,
) -> Result<ResponseData, Error>
pub async fn batch_delete( &mut self, request: BatchDeleteRequest, token: &str, ) -> Result<ResponseData, Error>
Deletes multiple records from the datastore with the provided request.
§Arguments
request
- The batch delete request containing the identifiers of the records to be deleted.token
- The authorization token to authorize the request.
§Returns
Ok(ResponseData)
- The response data containing the result of the operation.Err(Error)
- If the operation fails or if an error occurs during the process.
Sourcepub async fn update(
&mut self,
request: UpdateRequest,
token: &str,
) -> Result<ResponseData, Error>
pub async fn update( &mut self, request: UpdateRequest, token: &str, ) -> Result<ResponseData, Error>
Updates a record in the datastore with the provided request.
§Arguments
request
- The update request containing the record’s updated data.token
- The authorization token to authorize the request.
§Returns
Ok(ResponseData)
- The response data containing the result of the operation.Err(Error)
- If the operation fails or if an error occurs during the process.
Sourcepub async fn batch_update(
&mut self,
request: BatchUpdateRequest,
token: &str,
) -> Result<ResponseData, Error>
pub async fn batch_update( &mut self, request: BatchUpdateRequest, token: &str, ) -> Result<ResponseData, Error>
Updates multiple records in the datastore with the provided request.
§Arguments
request
- The batch update request containing the updated data for multiple records.token
- The authorization token to authorize the request.
§Returns
Ok(ResponseData)
- The response data containing the result of the operation.Err(Error)
- If the operation fails or if an error occurs during the process.
Sourcepub async fn get_by_filter(
&mut self,
request: GetByFilterRequest,
token: &str,
) -> Result<ResponseData, Error>
pub async fn get_by_filter( &mut self, request: GetByFilterRequest, token: &str, ) -> Result<ResponseData, Error>
Retrieves records from the datastore based on the specified filter.
§Arguments
request
- The request containing the filter criteria.token
- The authorization token to authorize the request.
§Returns
Ok(ResponseData)
- The response data containing the records that match the filter.Err(Error)
- If the operation fails or if an error occurs during the process.
Sourcepub async fn aggregate(
&mut self,
request: AggregateRequest,
token: &str,
) -> Result<ResponseData, Error>
pub async fn aggregate( &mut self, request: AggregateRequest, token: &str, ) -> Result<ResponseData, Error>
Performs aggregation on records in the datastore based on the provided request.
§Arguments
request
- The aggregation request specifying the criteria for aggregation.token
- The authorization token to authorize the request.
§Returns
Ok(ResponseData)
- The response data containing the result of the aggregation.Err(Error)
- If the operation fails or if an error occurs during the process.
Sourcepub async fn get_by_id(
&mut self,
request: GetByIdRequest,
token: &str,
) -> Result<ResponseData, Error>
pub async fn get_by_id( &mut self, request: GetByIdRequest, token: &str, ) -> Result<ResponseData, Error>
Retrieves a record from the datastore by its identifier.
§Arguments
request
- The request containing the identifier of the record to be retrieved.token
- The authorization token to authorize the request.
§Returns
Ok(ResponseData)
- The response data containing the requested record.Err(Error)
- If the operation fails or if an error occurs during the process.
Trait Implementations§
Source§impl Clone for DatastoreClient
impl Clone for DatastoreClient
Source§fn clone(&self) -> DatastoreClient
fn clone(&self) -> DatastoreClient
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl !Freeze for DatastoreClient
impl !RefUnwindSafe for DatastoreClient
impl Send for DatastoreClient
impl Sync for DatastoreClient
impl Unpin for DatastoreClient
impl !UnwindSafe for DatastoreClient
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request