pub struct ClientOptions {
pub username: String,
pub password: Secret,
pub default_database: String,
pub domain: Option<String>,
pub ipv4_only: bool,
pub cafile: Option<PathBuf>,
pub use_tls: bool,
pub compression: CompressionMethod,
pub ext: Extension,
}Expand description
Configuration options for a ClickHouse client connection and Arrow serialization.
The ClientOptions struct defines the settings used to establish a connection
to a ClickHouse server and handle data serialization/deserialization with
Apache Arrow. These options are typically set via super::builder::ClientBuilder methods
(e.g., super::builder::ClientBuilder::with_username,
super::builder::ClientBuilder::with_tls) or constructed directly for use with
crate::Client::connect.
§Fields
username: The username for authenticating withClickHouse(default:"default").password: The password for authentication, stored securely as aSecret.default_database: The default database for queries; if empty, usesClickHouse’s"default"database.domain: Optional domain for TLS verification; inferred from the destination if unset.ipv4_only: Iftrue, restricts address resolution to IPv4; iffalse, allows IPv6.cafile: Optional path to a certificate authority file for TLS connections.use_tls: Iftrue, enables TLS for secure connections; iffalse, uses plain TCP.compression: The compression method for data exchange (default:CompressionMethod::LZ4).arrow: Optional Arrow-specific serialization options (seeArrowOptions).cloud: Cloud-specific options forClickHousecloud instances (requirescloudfeature).
§Examples
use clickhouse_arrow::prelude::*;
let options = ClientOptions {
username: "admin".to_string(),
password: Secret::new("secret"),
default_database: "my_db".to_string(),
use_tls: true,
..ClientOptions::default()
};
let client = Client::connect("localhost:9000", options, None, None)
.await
.unwrap();Fields§
§username: StringUsername credential
password: SecretPassword credential. Secret is used to minimize likelihood of exposure through logs
default_database: StringScope this client to a specifc database, otherwise ‘default’ is used
domain: Option<String>For tls, provide the domain, otherwise it will be determined from the endpoint.
ipv4_only: boolWhether any non-ipv4 socket addrs should be filtered out.
cafile: Option<PathBuf>Provide a path to a certificate authority to use for tls.
use_tls: boolWhether a connection should be made securely over tls.
compression: CompressionMethodThe compression to use when sending data to clickhouse.
ext: ExtensionAdditional configuration not core to ClickHouse connections
Implementations§
Source§impl ClientOptions
impl ClientOptions
pub fn with_username(self, username: impl Into<String>) -> Self
pub fn with_password(self, password: impl Into<Secret>) -> Self
pub fn with_default_database(self, default_database: impl Into<String>) -> Self
pub fn with_domain(self, domain: impl Into<String>) -> Self
pub fn with_ipv4_only(self, ipv4_only: bool) -> Self
pub fn with_cafile<P: AsRef<Path>>(self, cafile: P) -> Self
pub fn with_use_tls(self, use_tls: bool) -> Self
pub fn with_compression(self, compression: CompressionMethod) -> Self
pub fn with_extension(self, ext: Extension) -> Self
pub fn extend(self, ext: impl Fn(Extension) -> Extension) -> Self
Trait Implementations§
Source§impl Clone for ClientOptions
impl Clone for ClientOptions
Source§fn clone(&self) -> ClientOptions
fn clone(&self) -> ClientOptions
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ClientOptions
impl Debug for ClientOptions
Source§impl Default for ClientOptions
impl Default for ClientOptions
Source§impl<'de> Deserialize<'de> for ClientOptions
impl<'de> Deserialize<'de> for ClientOptions
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ClientOptions
impl PartialEq for ClientOptions
Source§impl Serialize for ClientOptions
impl Serialize for ClientOptions
impl StructuralPartialEq for ClientOptions
Auto Trait Implementations§
impl Freeze for ClientOptions
impl RefUnwindSafe for ClientOptions
impl Send for ClientOptions
impl Sync for ClientOptions
impl Unpin for ClientOptions
impl UnwindSafe for ClientOptions
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)