Struct libsql_client::reqwest::Client
source · pub struct Client { /* private fields */ }
Expand description
Database client. This is the main structure used to communicate with the database.
Implementations§
source§impl Client
impl Client
sourcepub fn new(url: impl Into<String>, token: impl Into<String>) -> Self
pub fn new(url: impl Into<String>, token: impl Into<String>) -> Self
Creates a database client with JWT authentication.
Arguments
url
- URL of the database endpointtoken
- auth token
sourcepub fn from_credentials(
url: impl Into<String>,
username: impl Into<String>,
pass: impl Into<String>
) -> Self
pub fn from_credentials( url: impl Into<String>, username: impl Into<String>, pass: impl Into<String> ) -> Self
Creates a database client with Basic HTTP authentication.
Arguments
url
- URL of the database endpointusername
- database usernamepass
- user’s password
sourcepub fn from_config(config: Config) -> Result<Self>
pub fn from_config(config: Config) -> Result<Self>
Establishes a database client from a Config
object
sourcepub fn from_url<T: TryInto<Url>>(url: T) -> Result<Client>where
<T as TryInto<Url>>::Error: Display,
pub fn from_url<T: TryInto<Url>>(url: T) -> Result<Client>where <T as TryInto<Url>>::Error: Display,
pub fn from_env() -> Result<Client>
source§impl Client
impl Client
pub async fn raw_batch( &self, stmts: impl IntoIterator<Item = impl Into<Statement>> ) -> Result<BatchResult>
sourcepub async fn execute(
&self,
stmt: impl Into<Statement> + Send
) -> Result<ResultSet>
pub async fn execute( &self, stmt: impl Into<Statement> + Send ) -> Result<ResultSet>
Arguments
stmt
- the SQL statement
pub async fn execute_in_transaction( &self, _tx_id: u64, stmt: Statement ) -> Result<ResultSet>
pub async fn commit_transaction(&self, _tx_id: u64) -> Result<()>
pub async fn rollback_transaction(&self, _tx_id: u64) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnwindSafe for Client
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