cockroachutil

package
v0.28.4 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2020 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open added in v0.28.0

func Open(name string) (driver.Conn, error)

Open opens a new cockroachDB connection.

func OpenUnique

func OpenUnique(connStr string, schemaName string) (db *dbutil.TempDatabase, err error)

OpenUnique opens a temporary unique CockroachDB database that will be cleaned up when closed. It is expected that this should normally be used by way of "storj.io/storj/private/dbutil/tempdb".OpenUnique() instead of calling it directly.

func TranslateName added in v0.28.0

func TranslateName(name string) string

TranslateName changes the scheme name in a `cockroach://` URL to `postgres://`, as that is what lib/pq will expect.

Types

type Connector added in v0.28.0

type Connector struct {
	driver.Connector
}

Connector is a thin wrapper around a pq-based connector. This allows Driver to satisfy driver.DriverContext, and avoids weird breakage if and when we upgrade from pq 1.0 to pq 1.2 or higher.

func (*Connector) Driver added in v0.28.0

func (conn *Connector) Driver() driver.Driver

Driver returns the driver being used for this connector.

type Driver added in v0.28.0

type Driver struct {
	pq.Driver
}

Driver is the type for the "cockroach" sql/database driver. It uses github.com/lib/pq under the covers because of Cockroach's PostgreSQL compatibility, but allows differentiation between pg and crdb connections.

func (*Driver) Open added in v0.28.0

func (cd *Driver) Open(name string) (driver.Conn, error)

Open opens a new cockroachDB connection.

func (*Driver) OpenConnector added in v0.28.0

func (cd *Driver) OpenConnector(name string) (driver.Connector, error)

OpenConnector obtains a new db Connector, which sql.DB can use to obtain each needed connection at the appropriate time.

Jump to

Keyboard shortcuts

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