[−][src]Struct quaint::pooled::Quaint
The main entry point and an abstraction over database connections and
Fields
inner: Pool<QuaintManager>
Methods
impl Quaint
[src]
pub async fn new<'_>(url_str: &'_ str) -> Result<Self>
[src]
Create a new pool of connections to the database. The connection string follows the specified format:
connector_type://user:password@host/database?parameters
Connector type can be one of the following:
sqlite
/file
opens an SQLite connectionmysql
opens a MySQL connectionpostgres
/postgresql
opens a PostgreSQL connection
All parameters should be given in the query string format:
?key1=val1&key2=val2
. All parameters are optional.
Common parameters:
connection_limit
defines the number of connections opened to the database. If not set, defaults to the HikariCP Recommendation:physical_cpus * 2 + 1
.
SQLite:
user
/password
do not do anything and can be emitted.host
should point to the database file.db_name
parameter should give a name to the database attached for query namespacing.socket_timeout
defined in seconds. Acts as the busy timeout in SQLite. When set, queries that are waiting for a lock to be released will return theTimeout
error after the defined value.
PostgreSQL:
sslmode
eitherdisable
,prefer
orrequire
. Read moresslcert
should point to a PEM certificate file.sslidentity
should point to a PKCS12 certificate database.sslpassword
the password to open the PKCS12 database.sslaccept
eitherstrict
oraccept_invalid_certs
. If strict, the certificate needs to be valid and in the CA certificates.accept_invalid_certs
accepts any certificate from the server and can lead to weakened security. Defaults toaccept_invalid_certs
.schema
the default search path.host
additionally the host can be given as a parameter, typically in cases when connectiong to the database through a unix socket to separate the database name from the database path, such aspostgresql:///dbname?host=/var/run/postgresql
.socket_timeout
defined in seconds. If set, a query will return aTimeout
error if it fails to resolve before given time.connect_timeout
defined in seconds (default: 5). Connecting to a database will return aConnectTimeout
error if taking more than the defined value.
MySQL:
sslcert
should point to a PEM certificate file.sslidentity
should point to a PKCS12 certificate database.sslpassword
the password to open the PKCS12 database.sslaccept
eitherstrict
oraccept_invalid_certs
. If strict, the certificate needs to be valid and in the CA certificates.accept_invalid_certs
accepts any certificate from the server and can lead to weakened security. Defaults tostrict
.socket
needed when connecting to MySQL database through a unix socket. When set, the host parameter is dismissed.socket_timeout
defined in seconds. If set, a query will return aTimeout
error if it fails to resolve before given time.connect_timeout
defined in seconds (default: 5). Connecting to a database will return aConnectTimeout
error if taking more than the defined value.
pub async fn capacity<'_>(&'_ self) -> u32
[src]
The number of connections in the pool.
pub async fn check_out<'_>(&'_ self) -> Result<PooledConnection>
[src]
Reserve a connection from the pool.
pub fn connection_info(&self) -> &ConnectionInfo
[src]
Info about the connection and underlying database.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Quaint
impl Send for Quaint
impl Sync for Quaint
impl Unpin for Quaint
impl !UnwindSafe for Quaint
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,