Documentation
¶
Index ¶
- func WithConfigFile(configFile string) testcontainers.CustomizeRequestOption
- func WithDatabase(database string) testcontainers.CustomizeRequestOption
- func WithDefaultCredentials() testcontainers.CustomizeRequestOption
- func WithPassword(password string) testcontainers.CustomizeRequestOption
- func WithScripts(scripts ...string) testcontainers.CustomizeRequestOption
- func WithUsername(username string) testcontainers.CustomizeRequestOption
- type MySQLContainer
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithConfigFile ¶
func WithConfigFile(configFile string) testcontainers.CustomizeRequestOption
func WithDatabase ¶
func WithDatabase(database string) testcontainers.CustomizeRequestOption
func WithDefaultCredentials ¶
func WithDefaultCredentials() testcontainers.CustomizeRequestOption
func WithPassword ¶
func WithPassword(password string) testcontainers.CustomizeRequestOption
func WithScripts ¶
func WithScripts(scripts ...string) testcontainers.CustomizeRequestOption
func WithUsername ¶
func WithUsername(username string) testcontainers.CustomizeRequestOption
Types ¶
type MySQLContainer ¶
type MySQLContainer struct { testcontainers.Container // contains filtered or unexported fields }
MySQLContainer represents the MySQL container type used in the module
func RunContainer ¶
func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*MySQLContainer, error)
RunContainer creates an instance of the MySQL container type
Example ¶
// runMySQLContainer { ctx := context.Background() mysqlContainer, err := mysql.RunContainer(ctx, testcontainers.WithImage("mysql:8"), mysql.WithConfigFile(filepath.Join("testdata", "my_8.cnf")), mysql.WithDatabase("foo"), mysql.WithUsername("root"), mysql.WithPassword("password"), mysql.WithScripts(filepath.Join("testdata", "schema.sql")), ) if err != nil { panic(err) } // Clean up the container defer func() { if err := mysqlContainer.Terminate(ctx); err != nil { panic(err) } }() // } state, err := mysqlContainer.State(ctx) if err != nil { panic(err) } fmt.Println(state.Running)
Output: true
func (*MySQLContainer) ConnectionString ¶
Click to show internal directories.
Click to hide internal directories.