struct PQ::ConnInfo

Defined in:

pq/conninfo.cr

Constant Summary

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

Class Method Summary

Instance Method Summary

Constructor Detail

def self.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


[View source]
def self.new(uri : URI) #

Initializes with a URI


[View source]
def self.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"


[View source]

Class Method Detail

def self.from_conninfo_string(conninfo : String) #

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


[View source]

Instance Method Detail

def auth_methods : Array(String) #

[View source]
def database : String #

The database name.


[View source]
def host : String #

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


[View source]
def password : String | Nil #

The password. Optional.


[View source]
def port : Int32 #

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


[View source]
def sslcert : String | Nil #

The sslcert. Optional.


[View source]
def sslkey : String | Nil #

The sslkey. Optional.


[View source]
def sslmode : Symbol #

The sslmode. Optional (:prefer is default).


[View source]
def sslrootcert : String | Nil #

The sslrootcert. Optional.


[View source]
def user : String #

The user.


[View source]