A normalized description of how to reach a Postgres database.
Lantern is connection-agnostic: a host application hands it a source and Lantern opens one-shot connections from it. A source can be built from:
- a
postgres:///postgresql://URL string, - a keyword list / map of connection options, or
- any struct/map exposing
host/hostname,port,username,password, anddatabase(e.g. an Ecto-backed connection record), viafrom/1.
The struct mirrors the subset of Postgrex.start_link/1 options Lantern
needs. to_postgrex_opts/1 produces the final option list.
Summary
Functions
Builds a Source from a URL string, keyword list, map, or existing struct.
Parses a postgres://user:pass@host:port/database?sslmode=... URL.
Converts a Source into the keyword list passed to Postgrex.start_link/1.
Types
Functions
Builds a Source from a URL string, keyword list, map, or existing struct.
Returns {:ok, source} or {:error, reason}.
Parses a postgres://user:pass@host:port/database?sslmode=... URL.
Converts a Source into the keyword list passed to Postgrex.start_link/1.
pool_size is fixed at 1 — Lantern opens single, short-lived connections.