mysql

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DSN added in v0.5.0

func DSN(username, password, endpoint, port, tls string) string

DSN returns the DSN URL

func ExecWithBinlogAndFlush added in v0.8.0

func ExecWithBinlogAndFlush(ctx context.Context, db xsql.DB, query ExecQuery, options ExecOptions) error

ExecWithBinlogAndFlush is a wrapper function for xsql.DB.Exec() that allows the execution of optional queries before and after the provided query

func New

func New(creds map[string][]byte, tls *string) xsql.DB

New returns a new MySQL database client.

func QuoteIdentifier

func QuoteIdentifier(id string) string

QuoteIdentifier for MySQL queries

func QuoteValue

func QuoteValue(id string) string

QuoteValue for MySQL queries

func SplitUserHost

func SplitUserHost(user string) (username, host string)

SplitUserHost splits a MySQL user by name and host

Types

type ExecOptions added in v0.8.0

type ExecOptions struct {
	// Binlog defines whether storing binlogs will be disabled before executing the query. Defaults to true
	Binlog *bool
	// Flush defines whether privileges will be flushed after executing the query. Defaults to true
	Flush *bool
}

ExecOptions parametrizes which optional statements will be executed before or after ExecQuery.Query

type ExecQuery added in v0.8.0

type ExecQuery struct {
	// Query defines the sql statement to execute
	Query string
	// ErrorValue defines what error will be returned if the provided sql statement failed when executing
	ErrorValue string
}

ExecQuery declares the query to execute and its error value if it fails

Jump to

Keyboard shortcuts

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