mysql

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2025 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, binlog *bool) string

DSN returns the DSN URL

func ExecWrapper added in v0.10.0

func ExecWrapper(ctx context.Context, db xsql.DB, query ExecQuery) error

ExecWrapper 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, binlog *bool) 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 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