Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CredentialsProvider ¶
CredentialsProvider implementations are a source of Postgres data source names, where a data source name is a valid Postgres connection string (https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING).
The GetDataSourceName method is called each time a new database connection is required, e.g. each time the PgSecretsConnector.Connect method is called. If the PgSecretsConnector.Connect method fails with `invalid_password`, the GetDataSourceName method is called a further n times, where n is determined by the result of the Retries method. This presents an opportunity to attempt to connect with different sets of credentials, e.g. rotated_current and rotated_previous.
type PgSecretsConnector ¶
type PgSecretsConnector struct {
// contains filtered or unexported fields
}
PgSecretsConnector is the main library type and implements the driver.Connector interface. This means it can be passed to the sql.OpenDB method as a source of database connections. The connection string used to open a new database connection is sourced from the configured CredentialsProvider implementation.
func NewPgSecretsConnector ¶
func NewPgSecretsConnector(provider CredentialsProvider) *PgSecretsConnector
func (*PgSecretsConnector) Driver ¶
func (c *PgSecretsConnector) Driver() driver.Driver
Driver returns the underlying driver of the connector.