docker

package module
v0.0.0-...-9adfbcf Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAddr

func GetAddr() string

func NewSnapWithDocker

func NewSnapWithDocker(t *testing.T) (*pgsnap.Snap, error)

func RunPostgreInM

func RunPostgreInM(m *testing.M)

func RunPostgreInT

func RunPostgreInT(t *testing.T) (string, func() error, error)

func SetMigrationPath

func SetMigrationPath(path string)

SetMigrationPath set migration path

Types

type PostgreInDocker

type PostgreInDocker interface {
	// GetAddr returns the address to connect to
	GetAddr() string

	// Finish will stop the container
	Finish() error

	// GetLogs returns the logs of the container. It is useful for debugging
	GetLogs() string

	// WaitUntilReady will wait until the container is ready to accept connections
	WaitUntilReady() error
}

PostgreInDocker is an interface to manage a postgres container

func NewPostgreInDocker

func NewPostgreInDocker(cfg PostgresConfig) (PostgreInDocker, error)

type PostgresConfig

type PostgresConfig struct {
	// DockerEndpoint is the endpoint to connect to docker
	DockerEndpoint string

	// MigrationPath is the path to the sql migration files
	MigrationPath string

	// DebugMode will print the logs of the container
	DebugMode bool

	// ExplicitWait is the flag to enable the explicit wait
	ExplicitWait bool

	// PostgresVersion is the version of postgres to use
	PostgresVersion string

	// ContainerNameSuffix is the suffix to add to the container name
	ContainerNameSuffix string
}

Jump to

Keyboard shortcuts

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