Help us shape the future of Go! Take the 2026 Go Developer Survey

database

package
v1.7.14 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CockroachDBSQLPort = 26257
	RootSQLUser        = "root"
)

Variables

This section is empty.

Functions

func NewDbConnection

func NewDbConnection(dbConn *DBConnection) (*sql.DB, error)

NewDbConnection returns a new sql.DB instance to the corresponding CockroachDB pod. The DBConnection struct contains the information required to make the connection.

Types

type DBConnection

type DBConnection struct {
	Ctx context.Context
	// Client is the controller runtime client
	Client client.Client
	// RestConfig is the Kubernetes rest configuration
	RestConfig *rest.Config
	// ServiceName to connect to
	ServiceName string
	// Namespace that the pod is running in
	Namespace string
	// Database name that we connect to
	DatabaseName string
	// Port for the database connection
	Port *int32
	// RunningInsideK8s allows the database connection proxying
	// via a kube-proxy implementation
	RunningInsideK8s bool
	// UseSSL controls if the database connection utilizes SSL
	UseSSL bool
	// ClientCertificateSecretName is the name of the secret that contains the client CA and Key
	ClientCertificateSecretName string
	// RootCertificateSecretName is the name of the secret that contains the rootCA
	RootCertificateSecretName string
}

DBConnection represents a database connection into a CR Database

Jump to

Keyboard shortcuts

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