pub struct SqliteConnection { /* private fields */ }Expand description
A wrapper around a SQLite connection.
Implementations§
Source§impl SqliteConnection
impl SqliteConnection
Sourcepub fn new(conn: Connection, permit: OwnedSemaphorePermit) -> Self
pub fn new(conn: Connection, permit: OwnedSemaphorePermit) -> Self
Create a new connection wrapper (non-pooled).
Sourcepub async fn query(&self, sql: &str) -> SqliteResult<Vec<Value>>
pub async fn query(&self, sql: &str) -> SqliteResult<Vec<Value>>
Execute a query and return all rows as JSON values.
Sourcepub async fn query_params(
&self,
sql: &str,
params: Vec<Value>,
) -> SqliteResult<Vec<Value>>
pub async fn query_params( &self, sql: &str, params: Vec<Value>, ) -> SqliteResult<Vec<Value>>
Execute a query with parameters and return all rows.
Sourcepub async fn query_one(&self, sql: &str) -> SqliteResult<Value>
pub async fn query_one(&self, sql: &str) -> SqliteResult<Value>
Execute a query and return a single row.
Sourcepub async fn query_optional(&self, sql: &str) -> SqliteResult<Option<Value>>
pub async fn query_optional(&self, sql: &str) -> SqliteResult<Option<Value>>
Execute a query and return an optional row.
Sourcepub async fn execute(&self, sql: &str) -> SqliteResult<usize>
pub async fn execute(&self, sql: &str) -> SqliteResult<usize>
Execute a statement and return the number of affected rows.
Sourcepub async fn execute_params(
&self,
sql: &str,
params: Vec<Value>,
) -> SqliteResult<usize>
pub async fn execute_params( &self, sql: &str, params: Vec<Value>, ) -> SqliteResult<usize>
Execute a statement with parameters and return the number of affected rows.
Sourcepub async fn execute_insert(&self, sql: &str) -> SqliteResult<i64>
pub async fn execute_insert(&self, sql: &str) -> SqliteResult<i64>
Execute a statement and return the last insert rowid.
Sourcepub async fn execute_insert_params(
&self,
sql: &str,
params: Vec<Value>,
) -> SqliteResult<i64>
pub async fn execute_insert_params( &self, sql: &str, params: Vec<Value>, ) -> SqliteResult<i64>
Execute a statement with parameters and return the last insert rowid.
Sourcepub async fn execute_batch(&self, sql: &str) -> SqliteResult<()>
pub async fn execute_batch(&self, sql: &str) -> SqliteResult<()>
Execute multiple statements in a batch.
Sourcepub fn inner(&self) -> &Connection
pub fn inner(&self) -> &Connection
Get the inner connection.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SqliteConnection
impl !RefUnwindSafe for SqliteConnection
impl Send for SqliteConnection
impl Sync for SqliteConnection
impl Unpin for SqliteConnection
impl !UnwindSafe for SqliteConnection
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