Documentation
¶
Index ¶
- Variables
- func BuildDSN(opts Opts) (string, error)
- func Connect(dsn string) (*sql.DB, error)
- func ConnectWithOpts(opts Opts) (*sql.DB, error)
- type ChangeMasterOpt
- func WithChangeMasterCredentials(user, password string) ChangeMasterOpt
- func WithChangeMasterGtid(gtid string) ChangeMasterOpt
- func WithChangeMasterHost(host string) ChangeMasterOpt
- func WithChangeMasterPort(port int32) ChangeMasterOpt
- func WithChangeMasterRetries(retries int) ChangeMasterOpt
- func WithChangeMasterSSL(certPath, keyPath, caPath string) ChangeMasterOpt
- type ChangeMasterOpts
- type Client
- func NewClient(clientOpts ...Opt) (*Client, error)
- func NewClientWithMariaDB(ctx context.Context, mariadb *mariadbv1alpha1.MariaDB, ...) (*Client, error)
- func NewInternalClientWithPodIndex(ctx context.Context, mariadb *mariadbv1alpha1.MariaDB, ...) (*Client, error)
- func NewLocalClientWithPodEnv(ctx context.Context, env *environment.PodEnvironment, clientOpts ...Opt) (*Client, error)
- func (c *Client) AlterUser(ctx context.Context, accountName string, createUserOpts ...CreateUserOpt) error
- func (c *Client) ChangeMaster(ctx context.Context, changeMasterOpts ...ChangeMasterOpt) error
- func (c *Client) Close() error
- func (c *Client) CreateDatabase(ctx context.Context, database string, opts DatabaseOpts) error
- func (c *Client) CreateUser(ctx context.Context, accountName string, createUserOpts ...CreateUserOpt) error
- func (c *Client) DisableReadOnly(ctx context.Context) error
- func (c *Client) DropDatabase(ctx context.Context, database string) error
- func (c *Client) DropMaxScaleConfig(ctx context.Context) error
- func (c *Client) DropUser(ctx context.Context, accountName string) error
- func (c *Client) EnableReadOnly(ctx context.Context) error
- func (c *Client) Exec(ctx context.Context, sql string, args ...any) error
- func (c *Client) GaleraClusterSize(ctx context.Context) (int, error)
- func (c *Client) GaleraClusterStatus(ctx context.Context) (string, error)
- func (c *Client) GaleraLocalState(ctx context.Context) (string, error)
- func (c *Client) Grant(ctx context.Context, privileges []string, database string, table string, ...) error
- func (c *Client) IsSystemVariableEnabled(ctx context.Context, variable string) (bool, error)
- func (c *Client) LockTablesWithReadLock(ctx context.Context) error
- func (c *Client) MaxScaleConfigSyncVersion(ctx context.Context) (int, error)
- func (c *Client) ResetAllSlaves(ctx context.Context) error
- func (c *Client) ResetMaster(ctx context.Context) error
- func (c *Client) ResetSlavePos(ctx context.Context) error
- func (c *Client) Revoke(ctx context.Context, privileges []string, database string, table string, ...) error
- func (c *Client) SetSystemVariable(ctx context.Context, variable string, value string) error
- func (c *Client) SetSystemVariables(ctx context.Context, keyVal map[string]string) error
- func (c *Client) StartSlave(ctx context.Context) error
- func (c *Client) StatusVariable(ctx context.Context, variable string) (string, error)
- func (c *Client) StatusVariableInt(ctx context.Context, variable string) (int, error)
- func (c *Client) StopAllSlaves(ctx context.Context) error
- func (c *Client) SystemVariable(ctx context.Context, variable string) (string, error)
- func (c *Client) TruncateMaxScaleConfig(ctx context.Context) error
- func (c *Client) UnlockTables(ctx context.Context) error
- func (c *Client) UserExists(ctx context.Context, username, host string) (bool, error)
- func (c *Client) WaitForReplicaGtid(ctx context.Context, gtid string, timeout time.Duration) error
- type CreateUserOpt
- func WithIdentifiedBy(password string) CreateUserOpt
- func WithIdentifiedByPassword(password string) CreateUserOpt
- func WithIdentifiedVia(via string) CreateUserOpt
- func WithIdentifiedViaUsing(viaUsing string) CreateUserOpt
- func WithMaxUserConnections(maxConns int32) CreateUserOpt
- func WithTLSRequirements(require *mariadbv1alpha1.TLSRequirements) CreateUserOpt
- type CreateUserOpts
- type DatabaseOpts
- type GrantOption
- type Opt
- func WitHost(host string) Opt
- func WithDatabase(database string) Opt
- func WithMariadbTLS(name, namespace string, tlsCaCert []byte) Opt
- func WithMaxscaleTLS(name, namespace string, tlsCaCert []byte) Opt
- func WithParams(params map[string]string) Opt
- func WithPassword(password string) Opt
- func WithPort(port int32) Opt
- func WithTLSClientCert(clientName string, cert, privateKey []byte) Opt
- func WithTimeout(d time.Duration) Opt
- func WithUsername(username string) Opt
- type Opts
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrWaitReplicaTimeout = errors.New("timeout waiting for replica to be synced")
)
Functions ¶
Types ¶
type ChangeMasterOpt ¶ added in v0.37.0
type ChangeMasterOpt func(*ChangeMasterOpts)
func WithChangeMasterCredentials ¶ added in v0.37.0
func WithChangeMasterCredentials(user, password string) ChangeMasterOpt
func WithChangeMasterGtid ¶ added in v0.37.0
func WithChangeMasterGtid(gtid string) ChangeMasterOpt
func WithChangeMasterHost ¶ added in v0.37.0
func WithChangeMasterHost(host string) ChangeMasterOpt
func WithChangeMasterPort ¶ added in v0.37.0
func WithChangeMasterPort(port int32) ChangeMasterOpt
func WithChangeMasterRetries ¶ added in v0.37.0
func WithChangeMasterRetries(retries int) ChangeMasterOpt
func WithChangeMasterSSL ¶ added in v0.37.0
func WithChangeMasterSSL(certPath, keyPath, caPath string) ChangeMasterOpt
type ChangeMasterOpts ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientWithMariaDB ¶
func NewClientWithMariaDB(ctx context.Context, mariadb *mariadbv1alpha1.MariaDB, refResolver *refresolver.RefResolver, clientOpts ...Opt) (*Client, error)
func NewInternalClientWithPodIndex ¶
func NewInternalClientWithPodIndex(ctx context.Context, mariadb *mariadbv1alpha1.MariaDB, refResolver *refresolver.RefResolver, podIndex int, clientOpts ...Opt) (*Client, error)
func NewLocalClientWithPodEnv ¶ added in v0.0.26
func NewLocalClientWithPodEnv(ctx context.Context, env *environment.PodEnvironment, clientOpts ...Opt) (*Client, error)
func (*Client) ChangeMaster ¶
func (c *Client) ChangeMaster(ctx context.Context, changeMasterOpts ...ChangeMasterOpt) error
func (*Client) CreateDatabase ¶
func (*Client) CreateUser ¶
func (*Client) DropDatabase ¶
func (*Client) DropMaxScaleConfig ¶ added in v0.0.28
func (*Client) GaleraClusterSize ¶
func (*Client) GaleraClusterStatus ¶
func (*Client) GaleraLocalState ¶
func (*Client) IsSystemVariableEnabled ¶ added in v0.0.25
func (*Client) LockTablesWithReadLock ¶ added in v0.0.24
func (*Client) MaxScaleConfigSyncVersion ¶ added in v0.0.25
func (*Client) SetSystemVariable ¶
func (*Client) SetSystemVariables ¶
func (*Client) StatusVariable ¶
func (*Client) StatusVariableInt ¶
func (*Client) SystemVariable ¶
func (*Client) TruncateMaxScaleConfig ¶ added in v0.0.25
func (*Client) UnlockTables ¶ added in v0.0.24
func (*Client) UserExists ¶
type CreateUserOpt ¶ added in v0.0.28
type CreateUserOpt func(*CreateUserOpts)
func WithIdentifiedBy ¶ added in v0.0.28
func WithIdentifiedBy(password string) CreateUserOpt
func WithIdentifiedByPassword ¶ added in v0.0.30
func WithIdentifiedByPassword(password string) CreateUserOpt
func WithIdentifiedVia ¶ added in v0.0.30
func WithIdentifiedVia(via string) CreateUserOpt
func WithIdentifiedViaUsing ¶ added in v0.0.30
func WithIdentifiedViaUsing(viaUsing string) CreateUserOpt
func WithMaxUserConnections ¶ added in v0.0.28
func WithMaxUserConnections(maxConns int32) CreateUserOpt
func WithTLSRequirements ¶ added in v0.37.0
func WithTLSRequirements(require *mariadbv1alpha1.TLSRequirements) CreateUserOpt
type CreateUserOpts ¶
type CreateUserOpts struct { IdentifiedBy string IdentifiedByPassword string IdentifiedVia string IdentifiedViaUsing string Require *mariadbv1alpha1.TLSRequirements MaxUserConnections int32 }
type DatabaseOpts ¶
type GrantOption ¶
type GrantOption func(*grantOpts)
func WithGrantOption ¶
func WithGrantOption() GrantOption
type Opt ¶
type Opt func(*Opts)
func WithDatabase ¶
func WithMariadbTLS ¶ added in v0.37.0
func WithMaxscaleTLS ¶ added in v0.37.0
func WithParams ¶
func WithPassword ¶
func WithTLSClientCert ¶ added in v0.37.0
func WithTimeout ¶ added in v0.0.24
func WithUsername ¶
Click to show internal directories.
Click to hide internal directories.