glimr/db/db
Database Utilities
High-level database utilities for multi-database support.
NOTE: Pool management and transactions are now in driver packages:
- glimr_sqlite.start_pool(), glimr_sqlite.transaction()
- glimr_postgres.start_pool(), glimr_postgres.transaction()
Values
pub fn get_connection(
connections: List(driver.Connection),
name: String,
) -> driver.Connection
Finds a connection by name from a list of connections. Panics if the connection is not found.
pub fn get_connection_safe(
connections: List(driver.Connection),
name: String,
) -> Result(driver.Connection, Nil)
Finds a connection by name from a list of connections. Returns Error(Nil) if the connection is not found instead of panicking.
pub fn validate_connections(
connections: List(driver.Connection),
) -> Nil
Validates that all connection names are unique. Panics with a helpful message listing duplicate names if any are found. Call this when setting up database connections to catch configuration errors early.