struct

PQ::ConnInfo

Inherits Struct < Value < Object

Constants

SOCKET_SEARCH = ["/run/postgresql/.s.PGSQL.5432", "/tmp/.s.PGSQL.5432", "/var/run/postgresql/.s.PGSQL.5432"] of ::String
SUPPORTED_AUTH_METHODS = ["cleartext", "md5", "scram-sha-256"]

Constructors

new(host : String | Nil = nil, database : String | Nil = nil, user : String | Nil = nil, password : String | Nil = nil, port : Int | String | Nil = 5432, sslmode : String | Symbol | Nil = nil)

Create a new ConnInfo from all parts

Source
new(uri : URI)

Initializes with a URI

Source
new(params : Hash)

Initialize with a Hash

Valid keys match Postgres "conninfo" keys and are "host", "dbname", "user", "password", "port", "sslmode", "sslcert", "sslkey" and "sslrootcert"

Source

Class methods

from_conninfo_string(conninfo : String)

Initialize with either "postgres://" urls or postgres "key=value" pairs

Source

Instance methods

auth_methods
Source
database

The database name.

Source
host

The host. If starts with a / it is assumed to be a local Unix socket.

Source
password

The password. Optional.

Source
port

The port, defaults to 5432. It is ignored for local Unix sockets.

Source
sslcert

The sslcert. Optional.

Source
sslkey

The sslkey. Optional.

Source
sslmode

The sslmode. Optional (:prefer is default).

Source
sslrootcert

The sslrootcert. Optional.

Source
user

The user.

Source