pub struct EasyDB { /* private fields */ }
Expand description
The main type for dealing with easydb.
Create an EasyDB
using new
or from_uuid_token
.
Implementations§
Source§impl EasyDB
impl EasyDB
Sourcepub fn from_uuid_token(
uuid: String,
token: String,
url: Option<String>,
) -> EdbResult<Self>
pub fn from_uuid_token( uuid: String, token: String, url: Option<String>, ) -> EdbResult<Self>
Sourcepub fn put(&self, key: &str, value: &str) -> EdbResult<u16>
pub fn put(&self, key: &str, value: &str) -> EdbResult<u16>
Assigns value
to key
and returns the status code.
§Example
let status = edb.put("somekey", "somevalue")?;
Sourcepub fn put_json(&self, key: &str, value: Json) -> EdbResult<u16>
pub fn put_json(&self, key: &str, value: Json) -> EdbResult<u16>
Assigns a json value
to key
and returns the status code.
§Example
let status = edb.put_json("somekey", json!({"a": "b"}))?;
Sourcepub fn delete(&self, key: &str) -> EdbResult<u16>
pub fn delete(&self, key: &str) -> EdbResult<u16>
Deletes the value associated with key
and returns the status code.
§Example
let status = edb.delete("somekey")?;
Sourcepub fn get_writer<W>(&self, key: &str, value: &mut W) -> EdbResult<u16>where
W: Write,
pub fn get_writer<W>(&self, key: &str, value: &mut W) -> EdbResult<u16>where
W: Write,
An alternative to get()
that works with a writer. Fetches data associated with key
and
writes into value
, returning the status code.
The response should have the value that was originally set in JSON form. If the key was
never set, was deleted, or has no data, the response will be an empty string: ""
.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for EasyDB
impl<'de> Deserialize<'de> for EasyDB
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for EasyDB
impl !RefUnwindSafe for EasyDB
impl Send for EasyDB
impl Sync for EasyDB
impl Unpin for EasyDB
impl !UnwindSafe for EasyDB
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more