Documentation ¶
Index ¶
- func CreateDatabaseIfNotExists(ctx context.Context, sql SQLRunner, database, charset, collate string) error
- func CreateUserIfNotExists(ctx context.Context, sql SQLRunner, user, pass string, allowedHosts []string, ...) error
- func DropDatabase(ctx context.Context, sql SQLRunner, database string) error
- func DropUser(ctx context.Context, sql SQLRunner, user, host string) error
- func Escape(sql string) string
- type Config
- type Query
- type Rows
- type SQLRunner
- type SQLRunnerFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDatabaseIfNotExists ¶
func CreateDatabaseIfNotExists(ctx context.Context, sql SQLRunner, database, charset, collate string) error
CreateDatabaseIfNotExists creates a database if it doesn't already exist
func CreateUserIfNotExists ¶
func CreateUserIfNotExists(ctx context.Context, sql SQLRunner, user, pass string, allowedHosts []string, permissions []mysqlv1alpha1.MysqlPermission, resourceOptions corev1.ResourceList, ) error
CreateUserIfNotExists creates a user if it doesn't already exist and it gives it the specified permissions
func DropDatabase ¶
DropDatabase deletes the database
Types ¶
type Config ¶
Config is used to connect to a MysqlCluster
func NewConfigFromClusterKey ¶
NewConfigFromClusterKey returns a new Config based on a MySQLCluster key
func (*Config) GetMysqlDSN ¶
GetMysqlDSN returns a data source name
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query contains a escaped query string with variables marked with a question mark (?) and a slice of positional arguments
func BuildAtomicQuery ¶
BuildAtomicQuery concatenates the provided queries into a single query wrapped in a BEGIN COMMIT block
func ConcatenateQueries ¶
ConcatenateQueries concatenates the provided queries into a single query