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

Connection pool Manager served as Builder. Call create_pool after filling out your configs.

Implementations§

source§

impl Manager

source

pub fn new() -> Self

Create new ConnectionPool Manager

source

pub fn from_ado_string(conn_str: &str) -> SqlServerResult<Self>

Create a new ConnectionPool Manager and fills connection configs from ado string. For more details about ADO_String pleas refer to tiberius::Config::from_ado_string and Connection Strings in ADO.NET.

source

pub fn from_jdbc_string(conn_str: &str) -> SqlServerResult<Self>

Create new ConnectionPool Manager and fills connection config from jdbc string. For more details about jdbc_string pls refer to Building JDBC connection URL.

source

pub fn create_pool(self) -> Result<Pool, SqlServerError>

Consume self, builds a pool.

source

pub fn host(self, host: impl ToString) -> Self

Server host, defaults to localhost.

source

pub fn port(self, port: u16) -> Self

Server port, defaults to 1433.

source

pub fn database(self, database: impl ToString) -> Self

Database, defaults to master.

source

pub fn basic_authentication( self, username: impl ToString, password: impl ToString ) -> Self

Simplified authentication for those using username and password as login method.

source

pub fn authentication(self, authentication: AuthMethod) -> Self

Set tiberius::AuthMethod as authentication method.

source

pub fn trust_cert(self) -> Self

source

pub fn encryption(self, encryption: EncryptionLevel) -> Self

Set tiberius::EncryptionLevel as enctryption method.

source

pub fn trust_cert_ca(self, path: impl ToString) -> Self

source

pub fn instance_name(self, name: impl ToString) -> Self

Instance name defined in Sql Browser, defaults to None.

source

pub fn application_name(self, name: impl ToString) -> Self

source

pub fn max_size(self, value: usize) -> Self

Set pool size, defaults to 10.

source

pub fn wait_timeout<T: Into<f64> + Copy>(self, value: T) -> Self

Set timeout for when waiting for a connection object to become available.

source

pub fn create_timeout<T: Into<f64> + Copy>(self, value: T) -> Self

Set timeout for when creating a new connection object.

source

pub fn recycle_timeout<T: Into<f64> + Copy>(self, value: T) -> Self

Set timeout for when recycling a connection object.

source

pub fn pre_recycle_sync<T>(self, hook: T) -> Self
where T: Fn(&mut Client, &Metrics) -> HookResult<Error> + Sync + Send + 'static,

Attach a sync fn as hook to connection pool. The hook will be called each time before a connection deadpool::managed::Object is recycled.

source

pub fn pre_recycle_async<T>(self, hook: T) -> Self
where T: for<'a> Fn(&'a mut Client, &'a Metrics) -> HookFuture<'a, Error> + Sync + Send + 'static,

Attach an async fn as hook to connection pool. The hook will be called each time before a connection deadpool::managed::Object is recycled.

source

pub fn post_recycle_sync<T>(self, hook: T) -> Self
where T: Fn(&mut Client, &Metrics) -> HookResult<Error> + Sync + Send + 'static,

Attach a sync fn as hook to connection pool. The hook will be called each time af after a connection deadpool::managed::Object is recycled.

source

pub fn post_recycle_async<T>(self, hook: T) -> Self
where T: for<'a> Fn(&'a mut Client, &'a Metrics) -> HookFuture<'a, Error> + Sync + Send + 'static,

Attach an async fn as hook to connection pool. The hook will be called each time after a connection deadpool::managed::Object is recycled.

source

pub fn post_create_sync<T>(self, hook: T) -> Self
where T: Fn(&mut Client, &Metrics) -> HookResult<Error> + Sync + Send + 'static,

Attach a sync fn as hook to connection pool. The hook will be called each time after a connection deadpool::managed::Object is created.

source

pub fn post_create_async<T>(self, hook: T) -> Self
where T: for<'a> Fn(&'a mut Client, &'a Metrics) -> HookFuture<'a, Error> + Sync + Send + 'static,

Attach an async fn as hook to connection pool. The hook will be called each time after a connection deadpool::managed::Object is created.

Trait Implementations§

source§

impl Manager for Manager

§

type Type = Client<Compat<TcpStream>>

Type of Objects that this Manager creates and recycles.
§

type Error = Error

Error that this Manager can return when creating and/or recycling Objects.
source§

fn create<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<Client, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Creates a new instance of Manager::Type.
source§

fn recycle<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, obj: &'life1 mut Self::Type, _metrics: &'life2 Metrics ) -> Pin<Box<dyn Future<Output = RecycleResult<Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Tries to recycle an instance of Manager::Type. Read more
source§

fn detach(&self, _obj: &mut Self::Type)

Detaches an instance of Manager::Type from this Manager. Read more

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