postgres

package
v0.0.0-...-97396eb Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Tag   = "postgres"
	Image = "postgres"
	Port  = "5432/tcp"

	ContainerPrettyName = "Postgres"
)

Variables

View Source
var (
	WithUsername = postgres.WithUsername
	WithPassword = postgres.WithPassword
	WithDatabase = postgres.WithDatabase
)
View Source
var Module = mockestra.BuildContainerModule(
	Tag,
	fx.Provide(
		fx.Annotate(
			New,
			fx.ResultTags(`name:"postgres"`),
		),
		Actualize,
	),
)
View Source
var WithPostReadyHook = mockestra.WithPostReadyHook

Functions

func New

func New(p RequestParams) (*testcontainers.GenericContainerRequest, error)

New is a constructor that returns a testcontainers.GenericContainerRequest and takes its group tagged testcontainers.ContainerCustomizer as options. it is part of tri-phase process with Actualize and Run to create a testcontainers.Container.

func WithExtraDatabase

func WithExtraDatabase(databaseName, username, password string) testcontainers.CustomizeRequestOption

func WithMigration

func WithMigration(fn migration) testcontainers.CustomizeRequestOption

Types

type ContainerParams

type ContainerParams struct {
	fx.In
	Lifecycle fx.Lifecycle
	Request   *testcontainers.GenericContainerRequest `name:"postgres"`
}

type RequestParams

type RequestParams struct {
	fx.In
	Prefix  string                               `name:"prefix"`
	Version string                               `name:"postgres_version"`
	Opts    []testcontainers.ContainerCustomizer `group:"postgres"`
}

type Result

type Result struct {
	fx.Out
	Container      testcontainers.Container `name:"postgres"`
	ContainerGroup testcontainers.Container `group:"containers"`
}

func Actualize

func Actualize(p ContainerParams) (Result, error)

Actualize is a constructor that returns a testcontainers.Container it consumes previously instantiated testcontainers.GenericContainerRequest as part of its inputs, alongside with other tag specified testcontainers.GenericContainerRequest in order to reconcile its lifecycle dependencies before creating a testcontainers.Container.

Jump to

Keyboard shortcuts

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