Struct Options

Source
pub struct Options {
Show 19 fields pub addr: Url, pub database: String, pub username: String, pub password: String, pub compression: bool, pub pool_min: usize, pub pool_max: usize, pub nodelay: bool, pub keepalive: Option<Duration>, pub ping_before_query: bool, pub send_retries: usize, pub retry_timeout: Duration, pub ping_timeout: Duration, pub connection_timeout: Duration, pub query_timeout: Duration, pub insert_timeout: Option<Duration>, pub execute_timeout: Option<Duration>, pub readonly: Option<u8>, pub alt_hosts: Vec<Url>,
}
Expand description

Clickhouse connection options.

Fields§

§addr: Url

Address of clickhouse server (defaults to 127.0.0.1:9000).

§database: String

Database name. (defaults to default).

§username: String

User name (defaults to default).

§password: String

Access password (defaults to "").

§compression: bool

Enable compression (defaults to false).

§pool_min: usize

Lower bound of opened connections for Pool (defaults to 10).

§pool_max: usize

Upper bound of opened connections for Pool (defaults to 20).

§nodelay: bool

Whether to enable TCP_NODELAY (defaults to true).

§keepalive: Option<Duration>

TCP keep alive timeout in milliseconds (defaults to None).

§ping_before_query: bool

Ping server every time before execute any query. (defaults to true)

§send_retries: usize

Count of retry to send request to server. (defaults to 3)

§retry_timeout: Duration

Amount of time to wait before next retry. (defaults to 5 sec)

§ping_timeout: Duration

Timeout for ping (defaults to 500 ms)

§connection_timeout: Duration

Timeout for connection (defaults to 500 ms)

§query_timeout: Duration

Timeout for queries (defaults to 180 sec)

§insert_timeout: Option<Duration>

Timeout for inserts (defaults to 180 sec)

§execute_timeout: Option<Duration>

Timeout for execute (defaults to 180 sec)

§readonly: Option<u8>

Restricts permissions for read data, write data and change settings queries.

§alt_hosts: Vec<Url>

Comma separated list of single address host for load-balancing.

Implementations§

Source§

impl Options

Source

pub fn new<A>(addr: A) -> Self
where A: Into<Url>,

Constructs a new Options.

Source

pub fn database(self, database: &str) -> Self

Database name. (defaults to default).

Source

pub fn username(self, username: &str) -> Self

User name (defaults to default).

Source

pub fn password(self, password: &str) -> Self

Access password (defaults to "").

Source

pub fn with_compression(self) -> Self

Enable compression (defaults to false).

Source

pub fn pool_min(self, pool_min: usize) -> Self

Lower bound of opened connections for Pool (defaults to 10).

Source

pub fn pool_max(self, pool_max: usize) -> Self

Upper bound of opened connections for Pool (defaults to 20).

Source

pub fn nodelay(self, nodelay: bool) -> Self

Whether to enable TCP_NODELAY (defaults to true).

Source

pub fn keepalive(self, keepalive: Option<Duration>) -> Self

TCP keep alive timeout in milliseconds (defaults to None).

Source

pub fn ping_before_query(self, ping_before_query: bool) -> Self

Ping server every time before execute any query. (defaults to true).

Source

pub fn send_retries(self, send_retries: usize) -> Self

Count of retry to send request to server. (defaults to 3).

Source

pub fn retry_timeout(self, retry_timeout: Duration) -> Self

Amount of time to wait before next retry. (defaults to 5 sec).

Source

pub fn ping_timeout(self, ping_timeout: Duration) -> Self

Timeout for ping (defaults to 500 ms).

Source

pub fn connection_timeout(self, connection_timeout: Duration) -> Self

Timeout for connection (defaults to 500 ms).

Source

pub fn query_timeout(self, query_timeout: Duration) -> Self

Timeout for query (defaults to 180,000 ms).

Source

pub fn insert_timeout(self, insert_timeout: Option<Duration>) -> Self

Timeout for insert (defaults to 180,000 ms).

Source

pub fn execute_timeout(self, execute_timeout: Option<Duration>) -> Self

Timeout for execute (defaults to 180 sec).

Source

pub fn readonly(self, readonly: Option<u8>) -> Self

Restricts permissions for read data, write data and change settings queries.

Source

pub fn alt_hosts(self, alt_hosts: Vec<Url>) -> Self

Comma separated list of single address host for load-balancing.

Trait Implementations§

Source§

impl Clone for Options

Source§

fn clone(&self) -> Options

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Options

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Options

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl FromStr for Options

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

fn from_str(url: &str) -> Result<Self>

Parses a string s to return a value of this type. Read more
Source§

impl IntoOptions for Options

Source§

impl PartialEq for Options

Source§

fn eq(&self, other: &Options) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Options

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,