struct

PQ::ConnInfo

Inherits Struct / Value / Object

Constants

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

Constructors

new(host : String | Nil = nil, database : String | Nil = nil, user : String | Nil = nil, password : String | Nil = nil, port : Int | String | Nil = nil, sslmode : String | Symbol | Nil = nil, application_name : String | Nil = nil, replication : Nil | String = 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", "sslrootcert", "application_name", and "replication".

Source

Class methods

from_conninfo_string(conninfo : String)

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

Source

Instance methods

application_name

The application name. Optional (defaults to "crystal").

Source
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
replication
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