Struct collab2::db::ConnectOptions

pub struct ConnectOptions { /* private fields */ }
Expand description

Defines the configuration options of a database

Implementations§

§

impl ConnectOptions

pub fn new<T>(url: T) -> ConnectOptionswhere T: Into<String>,

Create new ConnectOptions for a [Database] by passing in a URI string

pub fn pool_options<DB>(self) -> PoolOptions<DB>where DB: Database,

Convert ConnectOptions into [sqlx::pool::PoolOptions]

pub fn get_url(&self) -> &str

Get the database URL of the pool

pub fn max_connections(&mut self, value: u32) -> &mut ConnectOptions

Set the maximum number of connections of the pool

pub fn get_max_connections(&self) -> Option<u32>

Get the maximum number of connections of the pool, if set

pub fn min_connections(&mut self, value: u32) -> &mut ConnectOptions

Set the minimum number of connections of the pool

pub fn get_min_connections(&self) -> Option<u32>

Get the minimum number of connections of the pool, if set

pub fn connect_timeout(&mut self, value: Duration) -> &mut ConnectOptions

Set the timeout duration when acquiring a connection

pub fn get_connect_timeout(&self) -> Option<Duration>

Get the timeout duration when acquiring a connection, if set

pub fn idle_timeout(&mut self, value: Duration) -> &mut ConnectOptions

Set the idle duration before closing a connection

pub fn get_idle_timeout(&self) -> Option<Duration>

Get the idle duration before closing a connection, if set

pub fn acquire_timeout(&mut self, value: Duration) -> &mut ConnectOptions

Set the maximum amount of time to spend waiting for acquiring a connection

pub fn get_acquire_timeout(&self) -> Option<Duration>

Get the maximum amount of time to spend waiting for acquiring a connection

pub fn max_lifetime(&mut self, lifetime: Duration) -> &mut ConnectOptions

Set the maximum lifetime of individual connections

pub fn get_max_lifetime(&self) -> Option<Duration>

Get the maximum lifetime of individual connections, if set

pub fn sqlx_logging(&mut self, value: bool) -> &mut ConnectOptions

Enable SQLx statement logging (default true)

pub fn get_sqlx_logging(&self) -> bool

Get whether SQLx statement logging is enabled

pub fn sqlx_logging_level(&mut self, level: LevelFilter) -> &mut ConnectOptions

Set SQLx statement logging level (default INFO) (ignored if sqlx_logging is false)

pub fn get_sqlx_logging_level(&self) -> LevelFilter

Get the level of SQLx statement logging

pub fn sqlcipher_key<T>(&mut self, value: T) -> &mut ConnectOptionswhere T: Into<Cow<'static, str>>,

set key for sqlcipher

pub fn set_schema_search_path<T>( &mut self, schema_search_path: T ) -> &mut ConnectOptionswhere T: Into<String>,

Set schema search path (PostgreSQL only)

Trait Implementations§

§

impl Clone for ConnectOptions

§

fn clone(&self) -> ConnectOptions

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
§

impl Debug for ConnectOptions

§

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

Formats the value using the given formatter. Read more
§

impl<T> From<T> for ConnectOptionswhere T: Into<String>,

§

fn from(s: T) -> ConnectOptions

Converts to this type from the input type.

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> 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

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> 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