pub struct Connection { /* private fields */ }Expand description
Postgres connection
Implementations§
Source§impl Connection
impl Connection
Sourcepub fn state(&self) -> ConnectionState
pub fn state(&self) -> ConnectionState
Get current connection state
Sourcepub async fn startup(&mut self, config: &ConnectionConfig) -> Result<()>
pub async fn startup(&mut self, config: &ConnectionConfig) -> Result<()>
Perform startup and authentication
Sourcepub async fn simple_query(&mut self, query: &str) -> Result<Vec<BackendMessage>>
pub async fn simple_query(&mut self, query: &str) -> Result<Vec<BackendMessage>>
Execute a simple query (returns all backend messages)
Sourcepub async fn streaming_query(
self,
query: &str,
chunk_size: usize,
max_memory: Option<usize>,
soft_limit_warn_threshold: Option<f32>,
soft_limit_fail_threshold: Option<f32>,
enable_adaptive_chunking: bool,
adaptive_min_chunk_size: Option<usize>,
adaptive_max_chunk_size: Option<usize>,
) -> Result<JsonStream>
pub async fn streaming_query( self, query: &str, chunk_size: usize, max_memory: Option<usize>, soft_limit_warn_threshold: Option<f32>, soft_limit_fail_threshold: Option<f32>, enable_adaptive_chunking: bool, adaptive_min_chunk_size: Option<usize>, adaptive_max_chunk_size: Option<usize>, ) -> Result<JsonStream>
Execute a streaming query
Note: This method consumes the connection. The stream maintains the connection internally. Once the stream is exhausted or dropped, the connection is closed.
Auto Trait Implementations§
impl !Freeze for Connection
impl !RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl !UnwindSafe for Connection
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