MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / sqlx_pool_options

Method sqlx_pool_options

src/driver/sqlx_common.rs:40–65  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

38impl ConnectOptions {
39 /// Convert [ConnectOptions] into [sqlx::pool::PoolOptions]
40 pub fn sqlx_pool_options<DB>(self) -> sqlx::pool::PoolOptions<DB>
41 where
42 DB: sqlx::Database,
43 {
44 let mut opt = sqlx::pool::PoolOptions::new();
45 if let Some(max_connections) = self.max_connections {
46 opt = opt.max_connections(max_connections);
47 }
48 if let Some(min_connections) = self.min_connections {
49 opt = opt.min_connections(min_connections);
50 }
51 if let Some(connect_timeout) = self.connect_timeout {
52 opt = opt.acquire_timeout(connect_timeout);
53 }
54 if let Some(idle_timeout) = self.idle_timeout {
55 opt = opt.idle_timeout(Some(idle_timeout));
56 }
57 if let Some(acquire_timeout) = self.acquire_timeout {
58 opt = opt.acquire_timeout(acquire_timeout);
59 }
60 if let Some(max_lifetime) = self.max_lifetime {
61 opt = opt.max_lifetime(Some(max_lifetime));
62 }
63 opt = opt.test_before_acquire(self.test_before_acquire);
64 opt
65 }
66}

Callers 3

connectMethod · 0.80
connectMethod · 0.80
connectMethod · 0.80

Calls 7

max_connectionsMethod · 0.80
min_connectionsMethod · 0.80
acquire_timeoutMethod · 0.80
idle_timeoutMethod · 0.80
max_lifetimeMethod · 0.80
test_before_acquireMethod · 0.80
newFunction · 0.50

Tested by

no test coverage detected