pub async fn create_pool(db_url: Option<&str>) -> DbResult<Arc<DbPool>>Expand description
Creates a connection pool for the database.
Initializes a connection pool with sensible defaults:
- Max connections: 4 for file-backed
SQLite, 1 for in-memorySQLite, 10 for other databases - Driver auto-detection: supports
SQLite,PostgreSQL,MySQL SQLitefile mode: read-write-create for file-based databases
The pool is wrapped in Arc for thread-safe sharing across async tasks.
§Arguments
db_url- Optional database connection URL. Defaults tosqlite://./agentic_api.dbifNone. Examples:sqlite://data.db,postgresql://user:pass@host/db
§Errors
Returns sqlx::Error if:
- Connection URL is invalid
- Database server is unreachable
- Connection limit is exceeded
- Authentication fails