glimr_postgres/http/context/ctx

PostgreSQL HTTP Context

Provides a context for managing PostgreSQL connection pools in HTTP applications. Use ctx.postgres.pool for the default pool and ctx.postgres.pool_for("name") for named connections.

Types

PostgreSQL context containing the default pool and a function to access named connection pools. Use pool for the default connection and pool_for to access named connections.

pub type PostgresContext {
  PostgresContext(
    pool: pool.Pool,
    pool_for: fn(String) -> pool.Pool,
  )
}

Constructors

Values

pub fn load(
  connections: List(driver.Connection),
) -> PostgresContext

Loads PostgreSQL pools from the given connections. Filters to only PostgreSQL connections and starts a pool for each.

Use ctx.postgres.pool to get the default pool (the one with is_default: True). Use ctx.postgres.pool_for("name") to access other connections by name.

Search Document