pub struct SqliteIndexedDB { /* private fields */ }Expand description
Main database interface that combines SQLite with IndexedDB persistence
Implementations§
Source§impl SqliteIndexedDB
impl SqliteIndexedDB
pub async fn new(config: DatabaseConfig) -> Result<Self, DatabaseError>
pub async fn execute(&mut self, sql: &str) -> Result<QueryResult, DatabaseError>
Sourcepub fn prepare(
&mut self,
sql: &str,
) -> Result<PreparedStatement<'_>, DatabaseError>
pub fn prepare( &mut self, sql: &str, ) -> Result<PreparedStatement<'_>, DatabaseError>
Prepare a SQL statement for efficient repeated execution
§Example
let mut stmt = db.prepare("SELECT * FROM users WHERE id = ?").unwrap();
for i in 1..=100 {
let result = stmt.execute(&[ColumnValue::Integer(i)]).await.unwrap();
}
stmt.finalize().unwrap();pub async fn execute_with_params( &mut self, sql: &str, params: &[ColumnValue], ) -> Result<QueryResult, DatabaseError>
Sourcepub async fn execute_batch(
&mut self,
statements: &[String],
) -> Result<(), DatabaseError>
pub async fn execute_batch( &mut self, statements: &[String], ) -> Result<(), DatabaseError>
Execute multiple SQL statements as a batch This is more efficient than calling execute() multiple times when crossing FFI boundaries as it reduces the number of bridge calls from N to 1
pub async fn sync(&mut self) -> Result<(), DatabaseError>
pub async fn close(&mut self) -> Result<(), DatabaseError>
pub fn get_connection(&self) -> &Connection
Auto Trait Implementations§
impl !Freeze for SqliteIndexedDB
impl !RefUnwindSafe for SqliteIndexedDB
impl Send for SqliteIndexedDB
impl !Sync for SqliteIndexedDB
impl Unpin for SqliteIndexedDB
impl !UnwindSafe for SqliteIndexedDB
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