DatastoreClient

Struct DatastoreClient 

Source
pub struct DatastoreClient { /* private fields */ }
Expand description

A client for interacting with the datastore service.

Implementations§

Source§

impl DatastoreClient

Source

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

pub async fn login( &mut self, request: LoginRequest, ) -> Result<LoginResponse, Error>

Logs in to the datastore service with the provided request.

§Arguments
  • request - The login request containing the necessary credentials.
§Returns
  • Ok(LoginResponse) - The response received after a successful login.
  • Err(Error) - If the login fails or if an error occurs during the process.
Source

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

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

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

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

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

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

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

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

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

pub async fn upsert( &mut self, request: UpsertRequest, token: &str, ) -> Result<ResponseData, Error>

Updates (if already present) or creates (if not) a record in the datastore.

§Arguments
  • request - The request containing the record to be updated or created (based on a list of conflict columns).
  • 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.
Source

pub async fn register_device( &mut self, request: RegisterDeviceRequest, token: &str, ) -> Result<ResponseData, Error>

Registeres a new account

§Arguments
  • request - The request containing the account info.
  • token - The authorization token to authorize the request.
§Returns
  • Ok(RegisterResponse) - The response data containing the result of the operation.
  • Err(Error) - If the operation fails or if an error occurs during the process.

Trait Implementations§

Source§

impl Clone for DatastoreClient

Source§

fn clone(&self) -> DatastoreClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DatastoreClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more