Documentation ¶
Overview ¶
Package pg provides opinionated Postgres types and providers for setting up Postgres DB connections using dependency injection.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewConnector ¶
func NewConnector(dsn ConnectionString) (driver.Connector, error)
NewConnector returns a connector from a connection string
Types ¶
type ConnectionConfig ¶
type ConnectionConfig struct { // DatabaseName - The name of the database to connect to DatabaseName string // User - The user to sign in as User string // Password - The user's password Password string // Host - The host to connect to. Values that start with / are for unix domain sockets. (default is localhost) Host string // Port - The port to bind to. (default is 5432) Port int // SslMode - Whether or not to use SSL (default is require, this is not the default for libpq) SslMode SslMode }
func NewConnectionConfig ¶
func NewConnectionConfig(cfgs ConnectionConfigs, name ConnectionName) (*ConnectionConfig, error)
NewConnectionConfig returns a ConnectionConfig from ConnectionConfigs by name
func (*ConnectionConfig) ConnectionString ¶
func (d *ConnectionConfig) ConnectionString() string
ConnectionString returns the connection string built from the d
type ConnectionConfigs ¶
type ConnectionConfigs map[ConnectionName]*ConnectionConfig
func NewConnectionConfigs ¶
func NewConnectionConfigs(cfg config.Value) (ConnectionConfigs, error)
NewConnectionConfigs returns a ConnectionConfigs from a config.Value
type ConnectionName ¶
type ConnectionName string
type ConnectionString ¶
type ConnectionString string
func NewConnectionString ¶
func NewConnectionString(config *ConnectionConfig) ConnectionString
NewConnectionString provides a ConnectionString from a ConnectionConfig
type SslMode ¶
type SslMode string
const ( // Disable - No SSL Disable SslMode = "disable" // Require - Always SSL (skip verification) Require SslMode = "require" // VerifyCa - Always SSL (verify that the certificate presented by the // server was signed by a trusted CA) VerifyCa SslMode = "verify-ca" // VerifyFull - Always SSL (verify that the certification presented by // the server was signed by a trusted CA and the server host name // matches the one in the certificate) VerifyFull SslMode = "verify-full" )
Click to show internal directories.
Click to hide internal directories.