Builds t/0 maps, suitable for pgc_client:start_link/1,2 (and, through it,
pgc:start_link/2,3).
Summary
Types
Parses a PostgreSQL connection URI, as documented at https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING.
Types
-type address() :: #{host := inet:hostname() | inet:ip_address(), port := socket:port_number()} | #{path := binary() | string()}.
-type from_uri_error() :: {invalid_uri, {atom(), term()}} | {invalid_scheme, unicode:chardata()} | {invalid_port, unicode:chardata()} | {invalid_userinfo, unicode:chardata()} | {invalid_parameter, unicode:chardata(), unicode:chardata() | true} | {unsupported_parameter, unicode:chardata()}.
Parses a PostgreSQL connection URI, as documented at https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING.
Supports a single host[:port] authority (no comma-separated multi-host failover lists),
user[:password]@, /database, and the host, port, sslmode, connect_timeout query
parameters plus a fixed set of session parameters (application_name, client_encoding,
datestyle, timezone, search_path, options, replication) -- anything else in the query
string is rejected rather than silently dropped, since a typo'd or unsupported parameter
(sslrootcert, target_session_attrs, ...) failing loudly beats it being quietly ignored.
-type t() :: #{address := address(), tls => disable | prefer | require, tls_options => [ssl:tls_client_option()], connect_timeout => timeout(), ping_interval => timeout(), user := unicode:chardata(), password => unicode:chardata() | fun(() -> unicode:chardata()), database := unicode:chardata(), parameters => #{atom() => unicode:chardata()}}.
Functions
-spec from_uri(unicode:chardata()) -> {ok, t()} | {error, from_uri_error()}.