pub struct Client {
pub connection: Arc<Mutex<AsyncConnection>>,
}Expand description
A client for interacting with Vertica database
Fields§
§connection: Arc<Mutex<AsyncConnection>>用于与 Vertica 数据库进行异步连接的连接对象,使用 Arc 和 Mutex 实现多线程安全
Implementations§
Source§impl Client
impl Client
Sourcepub async fn new(config: ConnectionConfig) -> Result<Self>
pub async fn new(config: ConnectionConfig) -> Result<Self>
Create a new client from connection configuration
Sourcepub async fn query(&self, sql: &str) -> Result<QueryResult>
pub async fn query(&self, sql: &str) -> Result<QueryResult>
Query the database
Sourcepub async fn execute(&self, sql: &str) -> Result<u64>
pub async fn execute(&self, sql: &str) -> Result<u64>
Execute a SQL statement (INSERT, UPDATE, DELETE, etc.)
Sourcepub async fn execute_with_params(
&self,
query: &str,
params: &[Value],
) -> Result<u64>
pub async fn execute_with_params( &self, query: &str, params: &[Value], ) -> Result<u64>
Execute a query with parameters
Sourcepub async fn execute_prepared(
&self,
stmt: &Statement,
params: &[Value],
) -> Result<QueryResult>
pub async fn execute_prepared( &self, stmt: &Statement, params: &[Value], ) -> Result<QueryResult>
Execute a prepared statement with parameters
Sourcepub async fn transaction(&self) -> Result<Transaction>
pub async fn transaction(&self) -> Result<Transaction>
Begin a transaction
Sourcepub async fn connection_state(&self) -> ConnectionState
pub async fn connection_state(&self) -> ConnectionState
Get connection state
Sourcepub async fn server_parameters(&self) -> HashMap<String, String>
pub async fn server_parameters(&self) -> HashMap<String, String>
Get server parameters
Sourcepub async fn execute_batch(&self, queries: &[&str]) -> Result<Vec<QueryResult>>
pub async fn execute_batch(&self, queries: &[&str]) -> Result<Vec<QueryResult>>
Execute a batch of queries
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
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