db

package
v0.14.4 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Error1045 = "Access denied for user"
View Source
const Error3159 = "Error 3159:"

Variables

This section is empty.

Functions

func ExecOrchestrator

func ExecOrchestrator(query string, args ...any) (sql.Result, error)

ExecOrchestrator will execute given query on the orchestrator backend database.

func IsSQLite

func IsSQLite() bool

func OpenDiscovery

func OpenDiscovery(host string, port int) (*sql.DB, error)

OpenDiscovery returns a DB instance to access a topology instance. It has lower read timeout than OpenTopology and is intended to be used with low-latency discovery queries.

func OpenOrchestrator

func OpenOrchestrator() (db *sql.DB, err error)

OpenTopology returns the DB instance for the orchestrator backed database

func OpenTopology

func OpenTopology(host string, port int) (*sql.DB, error)

OpenTopology returns a DB instance to access a topology instance.

func QueryOrchestrator

func QueryOrchestrator(query string, argsArray []any, onRow func(sqlutils.RowMap) error) error

QueryOrchestrator

func QueryOrchestratorBuffered

func QueryOrchestratorBuffered(query string, argsArray []any, onRow func(sqlutils.RowMap) error) error

QueryOrchestratorBuffered

func QueryOrchestratorRowsMap

func QueryOrchestratorRowsMap(query string, onRow func(sqlutils.RowMap) error) error

QueryRowsMapOrchestrator

func QueryOrchestratorRowsMapBuffered

func QueryOrchestratorRowsMapBuffered(query string, onRow func(sqlutils.RowMap) error) error

QueryOrchestratorRowsMapBuffered

func ReadTimeNow

func ReadTimeNow() (timeNow string, err error)

ReadTimeNow reads and returns the current timestamp as string. This is an unfortunate workaround to support both MySQL and SQLite in all possible timezones. SQLite only speaks UTC where MySQL has timezone support. By reading the time as string we get the database's de-facto notion of the time, which we can then feed back to it.

func SetupMySQLOrchestratorTLS

func SetupMySQLOrchestratorTLS(uri string) (string, error)

Create a TLS configuration from the config supplied CA, Certificate, and Private key. Register the TLS config with the mysql drivers as the "orchestrator" config Modify the supplied URI to call the TLS config

func SetupMySQLTopologyTLS

func SetupMySQLTopologyTLS(uri string) (string, error)

Create a TLS configuration from the config supplied CA, Certificate, and Private key. Register the TLS config with the mysql drivers as the "topology" config Modify the supplied URI to call the TLS config

Types

type DB added in v0.14.0

type DB interface {
	QueryOrchestrator(query string, argsArray []any, onRow func(sqlutils.RowMap) error) error
}
var (
	EmptyArgs []any
	Db        DB = (*vtorcDB)(nil)
)

type DummySQLResult added in v0.13.0

type DummySQLResult struct {
}

func (DummySQLResult) LastInsertId added in v0.13.0

func (dummyRes DummySQLResult) LastInsertId() (int64, error)

func (DummySQLResult) RowsAffected added in v0.13.0

func (dummyRes DummySQLResult) RowsAffected() (int64, error)

Jump to

Keyboard shortcuts

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