Struct libsql_client::local::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
pub fn from_env() -> Result<Self>
pub async fn sync(&self) -> Result<usize>
sourcepub fn raw_batch(
&self,
stmts: impl IntoIterator<Item = impl Into<Statement>>
) -> Result<BatchResult>
pub fn raw_batch( &self, stmts: impl IntoIterator<Item = impl Into<Statement>> ) -> Result<BatchResult>
Executes a batch of SQL statements. Each statement is going to run in its own transaction, unless they’re wrapped in BEGIN and END
§Arguments
stmts
- SQL statements
§Examples
let db = libsql_client::local::Client::new("/tmp/example321.db").unwrap();
let result = db
.raw_batch(["CREATE TABLE t(id)", "INSERT INTO t VALUES (42)"]);
sourcepub fn batch(
&self,
stmts: impl IntoIterator<Item = impl Into<Statement> + Send> + Send
) -> Result<Vec<ResultSet>>
pub fn batch( &self, stmts: impl IntoIterator<Item = impl Into<Statement> + Send> + Send ) -> Result<Vec<ResultSet>>
Executes a batch of SQL statements, wrapped in “BEGIN”, “END”, transaction-style. Each statement is going to run in its own transaction, unless they’re wrapped in BEGIN and END
§Arguments
stmts
- SQL statements
sourcepub fn execute(&self, stmt: impl Into<Statement> + Send) -> Result<ResultSet>
pub fn execute(&self, stmt: impl Into<Statement> + Send) -> Result<ResultSet>
§Arguments
stmt
- the SQL statement
pub fn execute_in_transaction( &self, _tx_id: u64, stmt: Statement ) -> Result<ResultSet>
pub fn commit_transaction(&self, _tx_id: u64) -> Result<()>
pub 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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request