tools

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: Apache-2.0, Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// DefaultMySQLUser is the default user to use to connect to the database
	DefaultMySQLUser = "root"
	// MaxRetries is the number of retries made while connecting
	MaxRetries = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Client struct {
		Password string
	}
}

Config represents configuration (password) required for client

type InnodbStats

type InnodbStats struct {
	FileIO           map[string]string
	Log              map[string]string
	BufferPoolAndMem map[string]string
	Transactions     map[string]string
	Metrics          map[string]string
}

InnodbStats represents information about InnoDB

func ParseInnodbStats

func ParseInnodbStats(blob string) (*InnodbStats, error)

ParseInnodbStats parses results from "SHOW ENGINE INNODB STATUS" query

type MysqlDB

type MysqlDB interface {
	// set the max number of database connections allowed at once
	SetMaxConnections(maxConns int)

	// makes query to database
	// returns result as a mapping of strings to string arrays
	// where key is column name and value is the items stored in column
	// in same order as rows
	QueryReturnColumnDict(query string) (map[string][]string, error)

	// makes query to database
	// returns result as a mapping of strings to string arrays
	// where key is the value stored in the first column of a row
	// and is mapped to the remaining values in the row
	// in the order as they appeared in the row
	QueryMapFirstColumnToRow(query string) (map[string][]string, error)

	// Log Prints in to the logger
	Log(in interface{})

	//wrapper for make_query, where if there is an error querying the database
	// retry connecting to the db and make the query
	QueryDb(query string) ([]string, [][]string, error)

	//wrapper for ExecQuery, which only returns a summary of the action taken
	DbExec(query string) (err error)

	// Closes the connection with the database
	Close()
}

MysqlDB interface defines few common methods used

func New

func New(user, password, host, config string) (MysqlDB, error)

New create connection to mysql database here if an error is encountered, still return database so that the logger may be used

Jump to

Keyboard shortcuts

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