Documentation ¶
Index ¶
- Constants
- func AssertMySQLError(t *testing.T, err error, code int)
- func NewTestErr(err error, format string, a ...any) error
- type Container
- type GoBuilder
- type MemoryUse
- type MySQLServer
- func (my MySQLServer) CreateUser(username, password, schema, authPlugin string) error
- func (my MySQLServer) DropUser(username string) error
- func (my MySQLServer) ExecApp(path string) ([]byte, error)
- func (my MySQLServer) ExecSQLStmt(stmt string) ([]byte, error)
- func (my MySQLServer) FlushPrivileges() error
- func (my MySQLServer) LoadSQLScript(scripts ...string) error
- func (my MySQLServer) Variable(scope, variable string) (string, error)
- type TestContext
Constants ¶
View Source
const ( AuthPluginNative = "mysql_native_password" AuthPluginCachedSha2 = "caching_sha2_password" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Container ¶
type Container struct { Name string // contains filtered or unexported fields }
func (Container) CheckRunning ¶
CheckRunning checks whether the container is running.
func (Container) CopyFileFromContainer ¶
CopyFileFromContainer copies a file from a Docker container.
type GoBuilder ¶
type GoBuilder struct { Container *Container // contains filtered or unexported fields }
func NewGoBuilder ¶
func NewGoBuilder(tctx *TestContext, container *Container) (*GoBuilder, error)
type MemoryUse ¶
type MemoryUse struct {
// contains filtered or unexported fields
}
func NewMemoryUse ¶
func NewMemoryUse() *MemoryUse
type MySQLServer ¶
type MySQLServer struct { Container *Container Schema string Version string // contains filtered or unexported fields }
func NewMySQLServer ¶
func NewMySQLServer(tctx *TestContext, container *Container, schema string) (*MySQLServer, error)
func (MySQLServer) CreateUser ¶
func (my MySQLServer) CreateUser(username, password, schema, authPlugin string) error
func (MySQLServer) DropUser ¶
func (my MySQLServer) DropUser(username string) error
func (MySQLServer) ExecApp ¶
func (my MySQLServer) ExecApp(path string) ([]byte, error)
ExecApp runs the application within the container found at path and returns its output.
func (MySQLServer) ExecSQLStmt ¶
func (my MySQLServer) ExecSQLStmt(stmt string) ([]byte, error)
ExecSQLStmt executes the SQL stmt using the mysql CLI within the container. This is not SQL-injection safe and is only used for testing.
func (MySQLServer) FlushPrivileges ¶
func (my MySQLServer) FlushPrivileges() error
func (MySQLServer) LoadSQLScript ¶
func (my MySQLServer) LoadSQLScript(scripts ...string) error
LoadSQLScript executes the statements from files provided as scripts using the mysql CLI within the container.
type TestContext ¶
type TestContext struct { MySQLRootPwd string XPluginAddr string MySQLAddr string Server *MySQLServer Builder *GoBuilder }
func New ¶
func New(schema string) (*TestContext, error)
Click to show internal directories.
Click to hide internal directories.