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) -> Selfwhere 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 copy 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

§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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