mssql

package module
v0.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAcceptEULA

func WithAcceptEULA() testcontainers.CustomizeRequestOption

func WithPassword

func WithPassword(password string) testcontainers.CustomizeRequestOption

Types

type MSSQLServerContainer

type MSSQLServerContainer struct {
	testcontainers.Container
	// contains filtered or unexported fields
}

MSSQLServerContainer represents the MSSQLServer container type used in the module

func RunContainer

func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*MSSQLServerContainer, error)

RunContainer creates an instance of the MSSQLServer container type

Example
// runMSSQLServerContainer {
ctx := context.Background()

password := "SuperStrong@Passw0rd"

mssqlContainer, err := mssql.RunContainer(ctx,
	testcontainers.WithImage("mcr.microsoft.com/mssql/server:2022-RTM-GDR1-ubuntu-20.04"),
	mssql.WithAcceptEULA(),
	mssql.WithPassword(password),
)
if err != nil {
	log.Fatalf("failed to start container: %s", err)
}

// Clean up the container
defer func() {
	if err := mssqlContainer.Terminate(ctx); err != nil {
		log.Fatalf("failed to terminate container: %s", err)
	}
}()
// }

state, err := mssqlContainer.State(ctx)
if err != nil {
	log.Fatalf("failed to get container state: %s", err) // nolint:gocritic
}

fmt.Println(state.Running)
Output:

true

func (*MSSQLServerContainer) ConnectionString

func (c *MSSQLServerContainer) ConnectionString(ctx context.Context, args ...string) (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL