Struct libsql_client::reqwest::Connection
source · pub struct Connection { /* private fields */ }
Expand description
Database connection. This is the main structure used to communicate with the database.
Implementations§
source§impl Connection
impl Connection
sourcepub fn connect(url: impl Into<String>, token: impl Into<String>) -> Self
pub fn connect(url: impl Into<String>, token: impl Into<String>) -> Self
Establishes a database connection with JWT authentication.
Arguments
url
- URL of the database endpointusername
- database usernamepass
- user’s password
sourcepub fn connect_with_credentials(
url: impl Into<String>,
username: impl Into<String>,
pass: impl Into<String>
) -> Self
pub fn connect_with_credentials( url: impl Into<String>, username: impl Into<String>, pass: impl Into<String> ) -> Self
Establishes a database connection with Basic HTTP authentication.
Arguments
url
- URL of the database endpointusername
- database usernamepass
- user’s password
sourcepub fn connect_from_url(url: &Url) -> Result<Connection>
pub fn connect_from_url(url: &Url) -> Result<Connection>
pub fn connect_from_env() -> Result<Connection>
Trait Implementations§
source§impl Clone for Connection
impl Clone for Connection
source§fn clone(&self) -> Connection
fn clone(&self) -> Connection
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Connection for Connection
impl Connection for Connection
source§fn batch<'life0, 'async_trait>(
&'life0 self,
stmts: impl 'async_trait + IntoIterator<Item = impl 'async_trait + Into<Statement>>
) -> Pin<Box<dyn Future<Output = Result<Vec<QueryResult>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn batch<'life0, 'async_trait>( &'life0 self, stmts: impl 'async_trait + IntoIterator<Item = impl 'async_trait + Into<Statement>> ) -> Pin<Box<dyn Future<Output = Result<Vec<QueryResult>>> + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Executes a batch of SQL statements.
Each statement is going to run in its own transaction,
unless they’re wrapped in BEGIN and END Read more
source§fn execute<'life0, 'async_trait>(
&'life0 self,
stmt: impl 'async_trait + Into<Statement>
) -> Pin<Box<dyn Future<Output = Result<QueryResult>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>( &'life0 self, stmt: impl 'async_trait + Into<Statement> ) -> Pin<Box<dyn Future<Output = Result<QueryResult>> + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Executes a single SQL statement Read more
source§fn transaction<'life0, 'async_trait>(
&'life0 self,
stmts: impl 'async_trait + IntoIterator<Item = impl 'async_trait + Into<Statement>>
) -> Pin<Box<dyn Future<Output = Result<Vec<QueryResult>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn transaction<'life0, 'async_trait>( &'life0 self, stmts: impl 'async_trait + IntoIterator<Item = impl 'async_trait + Into<Statement>> ) -> Pin<Box<dyn Future<Output = Result<Vec<QueryResult>>> + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Executes an SQL transaction.
Does not support nested transactions - do not use BEGIN or END
inside a transaction. Read more