[−][src]Struct turingdb_helpers::FieldQuery
Handles all queries releated to fields
#[derive(Debug, Serialize, Clone)] pub struct FieldQuery { db: String, document: String, field: String, payload: Option<T>, }
Implementations
impl<T> FieldQuery<T> where
T: Serialize,
[src]
T: Serialize,
pub async fn new() -> Self
[src]
pub async fn db<'_, '_, '_>(&'_ mut self, name: &'_ str) -> &'_ Self
[src]
Add a database name
Usage
use crate::FieldQuery; let mut foo = FieldQuery::new().await; foo.db("db_name").await;
pub async fn document<'_, '_, '_>(&'_ mut self, name: &'_ str) -> &'_ Self
[src]
Add a document name
Usage
use crate::FieldQuery; let mut foo = FieldQuery::new().await; foo .db("db_name").await .document("document_name").await;
pub async fn field<'_, '_, '_>(&'_ mut self, name: &'_ str) -> &'_ Self
[src]
Add a field name
Usage
use crate::FieldQuery; let mut foo = FieldQuery::new().await; foo .db("db_name").await .document("document_name").await .field("field_name").await;
pub async fn payload<'_, '_>(&'_ mut self, value: T) -> &'_ Self
[src]
Add a payload of bytes
This takes a generic value and convertes it into bytes using bincode
Usage
use crate::FieldQuery; let mut foo = FieldQuery::new().await; foo .db("db_name").await .document("document_name").await .field("field_name").await .payload("my_data_converted_into_bytes".as_bytes()).await;
pub async fn set<'_>(&'_ self) -> Result<Vec<u8>>
[src]
Inserts a key/value
to a document in a database
Usage
use crate::FieldQuery; let mut foo = FieldQuery::new().await; foo .db("db_name").await .document("document_name").await .field("field_name").await .payload("my_data_converted_into_bytes".as_bytes()).await .set().await
pub async fn get<'_>(&'_ self) -> Result<Vec<u8>>
[src]
Gets a value
to a document in a database by key
Usage
use crate::FieldQuery; let mut foo = FieldQuery::new().await; foo .db("db_name").await .document("document_name").await .field("field_name").await .get().await;
pub async fn list<'_>(&'_ self) -> Result<Vec<u8>>
[src]
List all the keys
in a document
Usage
use crate::FieldQuery; let mut foo = FieldQuery::new().await; foo .db("db_name").await .document("document_name").await .list().await;
pub async fn remove<'_>(&'_ self) -> Result<Vec<u8>>
[src]
Removes a value
from a document in a database by key
Usage
use crate::FieldQuery; let mut foo = FieldQuery::new().await; foo .db("db_name").await .document("document_name").await .field("field_name").await .remove().await;
pub async fn modify<'_>(&'_ self) -> Result<Vec<u8>>
[src]
Modifies a value
in a document in a database by its key
Usage
use crate::FieldQuery; let mut foo = FieldQuery::new().await; foo .db("db_name").await .document("document_name").await .field("field_name").await .payload("my_data_converted_into_bytes".as_bytes()).await .modify().await
Trait Implementations
impl<T: Clone> Clone for FieldQuery<T>
[src]
fn clone(&self) -> FieldQuery<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug> Debug for FieldQuery<T>
[src]
impl<T> Serialize for FieldQuery<T> where
T: Serialize,
[src]
T: Serialize,
Auto Trait Implementations
impl<T> RefUnwindSafe for FieldQuery<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for FieldQuery<T> where
T: Send,
T: Send,
impl<T> Sync for FieldQuery<T> where
T: Sync,
T: Sync,
impl<T> Unpin for FieldQuery<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for FieldQuery<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,