Struct sea_orm::ConnectOptions

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

Defines the configuration options of a database

Implementations§

source§

impl ConnectOptions

source

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

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

source

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

source

pub fn get_url(&self) -> &str

Get the database URL of the pool

source

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

Set the maximum number of connections of the pool

source

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

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

source

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

Set the minimum number of connections of the pool

source

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

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

source

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

Set the timeout duration when acquiring a connection

source

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

Get the timeout duration when acquiring a connection, if set

source

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

Set the idle duration before closing a connection

source

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

Get the idle duration before closing a connection, if set

source

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

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

source

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

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

source

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

Set the maximum lifetime of individual connections

source

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

Get the maximum lifetime of individual connections, if set

source

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

Enable SQLx statement logging (default true)

source

pub fn get_sqlx_logging(&self) -> bool

Get whether SQLx statement logging is enabled

source

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

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

source

pub fn sqlx_slow_statements_logging_settings( &mut self, level: LevelFilter, duration: Duration ) -> &mut Self

Set SQLx slow statements logging level and duration threshold (default LevelFilter::Off). (ignored if sqlx_logging is false)

source

pub fn get_sqlx_logging_level(&self) -> LevelFilter

Get the level of SQLx statement logging

source

pub fn get_sqlx_slow_statements_logging_settings( &self ) -> (LevelFilter, Duration)

Get the SQLx slow statements logging settings

source

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

set key for sqlcipher

source

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

Set schema search path (PostgreSQL only)

source

pub fn test_before_acquire(&mut self, value: bool) -> &mut Self

If true, the connection will be pinged upon acquiring from the pool (default true).

Trait Implementations§

source§

impl Clone for ConnectOptions

source§

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

impl Debug for ConnectOptions

source§

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

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

impl<T> From<T> for ConnectOptions
where T: Into<String>,

source§

fn from(s: T) -> ConnectOptions

Converts to this type from the input type.

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> 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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where 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 T
where 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 T
where 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<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

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