cockroach

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(
	ctx aws.Context,
	cc *ConnectionConfig, database string,
) (*sql.DB, error)

Connect to the cluster using a connection configuration.

func DefaultConnection

func DefaultConnection(ctx context.Context, host, application string) (*sql.DB, error)

DefaultConnection sets up a database connection to the provided host using the application name as both username and database name.

Types

type ConnectionConfig

type ConnectionConfig struct {
	// contains filtered or unexported fields
}

ConnectionConfig is a database configuration that can be used to create Cockroach database connection URLs.

func NewConnectionConfig

func NewConnectionConfig(
	ctx context.Context,
	user string,
	opts ConnectionOptions,
) (*ConnectionConfig, error)

NewConnectionconfig creates a new configuration for a given user and host.

func (*ConnectionConfig) CertificateDir

func (cc *ConnectionConfig) CertificateDir() string

CertificateDir returns the directory used for storing certificates.

func (*ConnectionConfig) DatabaseURL

func (cc *ConnectionConfig) DatabaseURL(database string) string

DatabaseURL creates a database URL for use with sql.Open.

type ConnectionOptions

type ConnectionOptions struct {
	SSM                  *ssm.SSM
	CertificateDirectory string
	DatabaseParameters   url.Values
	Host                 string
}

ConnectionOptions are used to control how we connect to the cluster.

type Credentials

type Credentials struct {
	CA          string `json:"ca"`
	Certificate string `json:"certificate"`
	Key         string `json:"key"`
}

Credentials are the credentials used to connect to and verify the identity of the database cluster.

Jump to

Keyboard shortcuts

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