rdspostgres

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package rdspostgres provides connections to AWS RDS PostgreSQL instances.

Index

Constants

View Source
const Scheme = "rdspostgres"

Scheme is the URL scheme rdspostgres registers its URLOpener under on postgres.DefaultMux.

Variables

This section is empty.

Functions

func Open

func Open(ctx context.Context, provider rds.CertPoolProvider, params *Params) (*sql.DB, func(), error)

Open opens an encrypted connection to an RDS database.

The second return value is a Wire cleanup function that calls Close on the database and ignores the error.

Types

type Params

type Params struct {
	// Endpoint is the host/port of the RDS database, like
	// "myinstance.borkxyzzy.us-west-1.rds.amazonaws.com:5432".
	// If no port is given, then 5432 is assumed.
	Endpoint string

	// User is the database user to connect as.
	User string
	// Password is the database user password to use.
	Password string
	// Database is the PostgreSQL database name to connect to.
	Database string

	// Values sets additional parameters, as documented in
	// https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS.
	Values url.Values

	// TraceOpts contains options for OpenCensus.
	TraceOpts []ocsql.TraceOption
}

Params specifies how to connect to an RDS database.

type URLOpener added in v0.13.0

type URLOpener struct {
	// TraceOpts contains options for OpenCensus.
	TraceOpts []ocsql.TraceOption
}

URLOpener opens RDS PostgreSQL URLs like "rdspostgres://user:password@myinstance.borkxyzzy.us-west-1.rds.amazonaws.com:5432/mydb".

func (*URLOpener) OpenPostgresURL added in v0.13.0

func (uo *URLOpener) OpenPostgresURL(ctx context.Context, u *url.URL) (*sql.DB, error)

OpenPostgresURL opens a new RDS database connection wrapped with OpenCensus instrumentation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL