Trait replit_db::Synchronous
source · pub trait Synchronous {
// Required methods
fn set(&self, key: impl ToString, value: impl ToString) -> Result<(), Error>;
fn get(&self, key: impl ToString) -> Result<String, Error>;
fn delete(&self, key: impl ToString) -> Result<(), Error>;
fn list(&self, prefix: Option<String>) -> Result<Vec<String>, Error>;
}Expand description
Synchronous support for Database struct. Use this trait by import it then use it right away!
Required Methods§
sourcefn set(&self, key: impl ToString, value: impl ToString) -> Result<(), Error>
fn set(&self, key: impl ToString, value: impl ToString) -> Result<(), Error>
Set a variable. key and value MUST implement std::string::ToString trait OR you could convert them to std::string::String instead.
Possible Exception is ErrorKind::HttpError for HttpError
sourcefn get(&self, key: impl ToString) -> Result<String, Error>
fn get(&self, key: impl ToString) -> Result<String, Error>
Get a variable you just set. key MUST implement std::string::ToString trait OR you could convert them to std::string::String instead.
Possible Exceptions are ErrorKind::HttpError for HttpError, ErrorKind::NoItemFoundError for no items were found in the database
sourcefn delete(&self, key: impl ToString) -> Result<(), Error>
fn delete(&self, key: impl ToString) -> Result<(), Error>
Delete a variable you just set. MUST implement std::string::ToString trait OR you could convert them to std::string::String instead.
Possible Exceptions are ErrorKind::HttpError for HttpError, ErrorKind::NoItemFoundError for no items were found in the database