Documentation ¶
Overview ¶
Package pgutil provides utilities for Postgres
Index ¶
Constants ¶
View Source
const ( SSLBlank sslMode = "" SSLDisable = "disable" SSLAllow = "allow" SSLPrefer = "prefer" SSLRequire = "require" SSLVerifyCa = "verify-ca" SSLVerifyFull = "verify-full" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionOptions ¶
type ConnectionOptions struct { Host string Port string User string Password string DBName string SSLMode string }
ConnectionOptions represents the configurable options of a connection to a Postgres database
func NewFromURL ¶
func NewFromURL(rawurl string, opts ...Opts) (ConnectionOptions, error)
NewFromURL returns a ConnectionOptions from a given URL. This uses a format like `postgres://myuser:mypass@localhost/somedatabase`, which is commonly found on hosting platforms.
func (ConnectionOptions) String ¶
func (c ConnectionOptions) String() string
String implements the Stringer interface so that a pgutil.ConnectionOptions can be converted into a value key/value connection string
type Opts ¶
type Opts func(*ConnectionOptions)
func WithSSL ¶
func WithSSL(requestedSslMode sslMode) Opts
WithSSL sets the sslmode parameter for postgresql. See the postgresql documentation at https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING
Click to show internal directories.
Click to hide internal directories.