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
46
47
48
//! Connection builder for creating store instances.
use crateAnyStore;
use crateConfig;
/// Connect to a database using a DSN string.
///
/// This is a convenience function that wraps `AnyStore::connect_with_dsn()`.
/// For advanced configuration (custom schema, connection pool size, etc.),
/// use `pgqrs::connect_with_config(&config)` instead.
///
/// # Arguments
/// * `dsn` - Database connection string (e.g., "postgresql://localhost/mydb")
///
/// # Example
/// ```no_run
/// # use pgqrs;
/// # async fn example() -> Result<(), Box<dyn std::error::Error>> {
/// let store = pgqrs::connect("postgresql://localhost/mydb").await?;
/// # Ok(())
/// # }
/// ```
pub async
/// Connect to a database using a configuration object.
///
/// This is the primary way to connect to a database with custom configuration.
/// Use this when you need custom configuration like schema, pool size, etc.
///
/// # Arguments
/// * `config` - Configuration object
///
/// # Example
/// ```no_run
/// # use pgqrs::{self, Config};
/// # async fn example() -> Result<(), Box<dyn std::error::Error>> {
/// let config = Config::from_dsn("postgresql://localhost/mydb")
/// .with_schema("my_schema")
/// .with_max_connections(20);
/// let store = pgqrs::connect_with_config(&config).await?;
/// # Ok(())
/// # }
/// ```
pub async