pub struct Connection { /* private fields */ }Expand description
Async connection wrapper for TCP/TLS socket This is the async I/O boundary - all socket operations are async
Implementations§
Source§impl Connection
impl Connection
Sourcepub async fn connect(host: &str, port: u16) -> Result<Self>
pub async fn connect(host: &str, port: u16) -> Result<Self>
Connect to a ClickHouse server with default options
Sourcepub async fn connect_with_options(
host: &str,
port: u16,
options: &ConnectionOptions,
) -> Result<Self>
pub async fn connect_with_options( host: &str, port: u16, options: &ConnectionOptions, ) -> Result<Self>
Connect to a ClickHouse server with custom options
Sourcepub async fn read_varint(&mut self) -> Result<u64>
pub async fn read_varint(&mut self) -> Result<u64>
Read a varint-encoded u64
Sourcepub async fn write_varint(&mut self, value: u64) -> Result<()>
pub async fn write_varint(&mut self, value: u64) -> Result<()>
Write a varint-encoded u64
Sourcepub async fn write_u128(&mut self, value: u128) -> Result<()>
pub async fn write_u128(&mut self, value: u128) -> Result<()>
Write a little-endian u128
Sourcepub async fn read_string(&mut self) -> Result<String>
pub async fn read_string(&mut self) -> Result<String>
Read a length-prefixed string
Sourcepub async fn write_string(&mut self, s: &str) -> Result<()>
pub async fn write_string(&mut self, s: &str) -> Result<()>
Write a length-prefixed string
Sourcepub async fn write_quoted_string(&mut self, s: &str) -> Result<()>
pub async fn write_quoted_string(&mut self, s: &str) -> Result<()>
Write a quoted string for query parameters
Sourcepub async fn read_bytes(&mut self, len: usize) -> Result<Bytes>
pub async fn read_bytes(&mut self, len: usize) -> Result<Bytes>
Read exact number of bytes into a buffer
Sourcepub async fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
pub async fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
Read bytes into an existing buffer
Sourcepub async fn write_bytes(&mut self, data: &[u8]) -> Result<()>
pub async fn write_bytes(&mut self, data: &[u8]) -> Result<()>
Write bytes
Sourcepub async fn read_packet(&mut self) -> Result<Bytes>
pub async fn read_packet(&mut self) -> Result<Bytes>
Read a complete packet (length-prefixed data) Returns the packet data without the length prefix
Sourcepub async fn write_packet(&mut self, data: &[u8]) -> Result<()>
pub async fn write_packet(&mut self, data: &[u8]) -> Result<()>
Write a packet with length prefix
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