psqldocker

package
v0.0.0-...-e145186 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package psqldocker provides functions to start, stop and configure a PostgreSQL docker container. The purpose of this package is mainly for testing.

The docker container is created programatically using the github.com/ory/dockertest package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	// contains filtered or unexported fields
}

Container represents a Docker container running a PostgreSQL image.

func NewContainer

func NewContainer(
	user,
	password,
	dbName string,
	opts ...Option,
) (*Container, error)

NewContainer starts a new psql database in a docker container.

func (Container) Close

func (c Container) Close() error

Close removes the Docker container.

func (Container) Port

func (c Container) Port() string

Port returns the container host port mapped to the database running inside it.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option configures an BTC Node Docker.

func WithContainerName

func WithContainerName(name string) Option

WithContainerName configures the PSQL Container Name, if empty, a random one will be picked.

func WithDBPort

func WithDBPort(name string) Option

WithDBPort sets database port running in the container, default 5432.

func WithPool

func WithPool(pool *dockertest.Pool) Option

WithPool sets the docker container newPool.

func WithSql

func WithSql(sql string) Option

WithSql specifies a sqls file, to initiate the db with.

Jump to

Keyboard shortcuts

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