Skip to content

Initializer

init(host:port:username:password:database:tls:)

Create a configuration for connecting to a server with a hostname and optional port.
init(host: String, port: Int = 5432, username: String, password: String?, database: String?, tls: PostgresConnection.Configuration.TLS)

Parameters

host

The hostname to connect to.

port

The TCP port to connect to (defaults to 5432).

username

The username to authenticate with.

password

The password to authenticate with.

database

The database to open. If nil, the client connects to the server’s default database.

tls

The TLS mode to use.

Discussion

This specifies a TCP connection. If you’re unsure which kind of connection you want, you almost definitely want this one.