1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! Database connection and pool management
//!
//! This module exposes the `Database` handle used by query builders, model
//! helpers, and transactions.
//!
//! If database calls fail early, the most common causes are:
//! - the global database was never initialized with `Database::init()` or
//! `Database::set_global()`
//! - the connection URL is wrong for the selected backend
//! - the current code is running outside the transaction or database scope you
//! expected
//!
//! Use `Database::connect()` for straightforward setup. Use
//! `Database::builder()` when you need to adjust pool limits or timeouts.
//!
//! Practical split:
//! - use `Database::connect()` when you already know the URL and defaults are fine
//! - use `Database::builder()` when pool sizing, idle counts, or timeouts need tuning
//! - use the global handle only after startup initialization is finished, otherwise model helpers fail before they ever reach the backend
//!
//! If a query unexpectedly uses the wrong connection, check whether code is
//! still inside the intended transaction scope or whether it fell back to the
//! global handle.
pub use DatabaseBuilder;
pub use Database;
pub use ;
pub use ;
pub use ConnectionRef;
pub use DatabaseHandle;