Struct db2::kvp::KEY_VALUE_STORE
source · pub struct KEY_VALUE_STORE { /* private fields */ }
Methods from Deref<Target = KeyValueStore>§
pub fn read_kvp(&self, key: &str) -> Result<Option<String>>
pub async fn write_kvp(&self, key: String, value: String) -> Result<()>
pub async fn delete_kvp(&self, key: String) -> Result<()>
Methods from Deref<Target = ThreadSafeConnection<KeyValueStore>>§
pub fn write<T>( &self, callback: impl Send + FnOnce(&Connection) -> T + 'static ) -> impl Future<Output = T>where T: 'static + Send + Sync,
Methods from Deref<Target = Connection>§
pub fn persistent(&self) -> bool
pub fn can_write(&self) -> bool
pub fn backup_main(&self, destination: &Connection) -> Result<(), Error>
pub fn backup_main_to(&self, destination: impl AsRef<Path>) -> Result<(), Error>
pub fn sql_has_syntax_error(&self, sql: &str) -> Option<(String, usize)>
pub fn migrate(
&self,
domain: &'static str,
migrations: &[&'static str]
) -> Result<(), Error>
pub fn migrate( &self, domain: &'static str, migrations: &[&'static str] ) -> Result<(), Error>
Migrate the database, for the given domain. Note: Unlike everything else in SQLez, migrations are run eagerly, without first preparing the SQL statements. This makes it possible to do multi-statement schema updates in a single string without running into prepare errors.
pub fn with_savepoint<R, F>( &self, name: impl AsRef<str>, f: F ) -> Result<R, Error>where F: FnOnce() -> Result<R, Error>,
pub fn with_savepoint_rollback<R, F>( &self, name: impl AsRef<str>, f: F ) -> Result<Option<R>, Error>where F: FnOnce() -> Result<Option<R>, Error>,
pub fn exec<'a>(&'a self, query: &str) -> Result<impl FnMut() + 'a, Error>
pub fn exec<'a>(&'a self, query: &str) -> Result<impl FnMut() + 'a, Error>
Prepare a statement which has no bindings and returns nothing.
Note: If there are multiple statements that depend upon each other (such as those which make schema changes), preparation will fail. Use a true migration instead.
pub fn exec_bound<B, 'a>(
&'a self,
query: &str
) -> Result<impl FnMut(B) + 'a, Error>where
B: Bind,
pub fn exec_bound<B, 'a>( &'a self, query: &str ) -> Result<impl FnMut(B) + 'a, Error>where B: Bind,
Prepare a statement which takes a binding, but returns nothing. The bindings for a given invocation should be passed to the returned closure
Note: If there are multiple statements that depend upon each other (such as those which make schema changes), preparation will fail. Use a true migration instead.
pub fn select<C, 'a>(&'a self, query: &str) -> Result<impl FnMut() + 'a, Error>where
C: Column,
pub fn select<C, 'a>(&'a self, query: &str) -> Result<impl FnMut() + 'a, Error>where C: Column,
Prepare a statement which has no bindings and returns a Vec<C>
.
Note: If there are multiple statements that depend upon each other (such as those which make schema changes), preparation will fail. Use a true migration instead.
pub fn select_bound<B, C, 'a>(
&'a self,
query: &str
) -> Result<impl FnMut(B) + 'a, Error>where
B: Bind,
C: Column,
pub fn select_bound<B, C, 'a>( &'a self, query: &str ) -> Result<impl FnMut(B) + 'a, Error>where B: Bind, C: Column,
Prepare a statement which takes a binding and returns a Vec<C>
.
Note: If there are multiple statements that depend upon each other (such as those which make schema changes), preparation will fail. Use a true migration instead.
pub fn select_row<C, 'a>(
&'a self,
query: &str
) -> Result<impl FnMut() + 'a, Error>where
C: Column,
pub fn select_row<C, 'a>( &'a self, query: &str ) -> Result<impl FnMut() + 'a, Error>where C: Column,
Prepare a statement that selects a single row from the database. Will return none if no rows are returned and will error if more than 1 row
Note: If there are multiple statements that depend upon each other (such as those which make schema changes), preparation will fail. Use a true migration instead.
pub fn select_row_bound<B, C, 'a>(
&'a self,
query: &str
) -> Result<impl FnMut(B) + 'a, Error>where
B: Bind,
C: Column,
pub fn select_row_bound<B, C, 'a>( &'a self, query: &str ) -> Result<impl FnMut(B) + 'a, Error>where B: Bind, C: Column,
Prepare a statement which takes a binding and selects a single row from the database. WIll return none if no rows are returned and will error if more than 1 row is returned.
Note: If there are multiple statements that depend upon each other (such as those which make schema changes), preparation will fail. Use a true migration instead.