Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithAcceptEULA ¶
func WithAcceptEULA() testcontainers.CustomizeRequestOption
WithAcceptEULA sets the ACCEPT_EULA environment variable to "Y", indicating acceptance of the Microsoft Azure SQL Edge End-User License Agreement. This option is required; Run returns an error if it is not provided.
func WithPassword ¶
func WithPassword(password string) testcontainers.CustomizeRequestOption
WithPassword sets the MSSQL_SA_PASSWORD environment variable to the provided password. The password must meet SQL Server complexity requirements: uppercase + lowercase + number + special char.
Types ¶
type Container ¶
type Container struct {
testcontainers.Container
// contains filtered or unexported fields
}
Container represents the Azure SQL Edge container type used in the module
func Run ¶
func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*Container, error)
Run creates an instance of the Azure SQL Edge container type. Callers must pass WithAcceptEULA() to accept the Microsoft license agreement.
Example ¶
package main
import (
"context"
"fmt"
"log"
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/modules/azure/sqledge"
)
func main() {
// runSQLEdgeContainer {
ctx := context.Background()
sqlEdgeContainer, err := sqledge.Run(ctx,
"mcr.microsoft.com/azure-sql-edge:1.0.7",
sqledge.WithAcceptEULA(),
sqledge.WithPassword("Strong!Passw0rd"),
)
defer func() {
if err := testcontainers.TerminateContainer(sqlEdgeContainer); err != nil {
log.Printf("failed to terminate container: %s", err)
}
}()
if err != nil {
log.Printf("failed to start container: %s", err)
return
}
// }
state, err := sqlEdgeContainer.State(ctx)
if err != nil {
log.Printf("failed to get container state: %s", err)
return
}
fmt.Println(state.Running)
}
Output: true
func (*Container) ConnectionString ¶
ConnectionString returns the connection string for the Azure SQL Edge container, using the default 1433 port. Additional query parameters may be appended via args. Example: container.ConnectionString(ctx, "encrypt=false", "TrustServerCertificate=true")