postgresenv

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(
	ctx context.Context,
	env Environment,
	mig migrations.Migrations,
	initialQueries ...migrations.Query,
) (db *sql.DB, term func(), err error)

func Reuse

func Reuse(
	ctx context.Context,
	reuse *Reusable,
	mig migrations.Migrations,
	initialQueries ...migrations.Query,
) (db *sql.DB, term func(), err error)

func ReuseForTesting

func ReuseForTesting(
	t *testing.T,
	reuse *Reusable,
	mig migrations.Migrations,
	initialQueries ...migrations.Query,
) *sql.DB

func UseExternal

func UseExternal(
	ctx context.Context,
	migrations migrations.Migrations,
	initialQueries ...migrations.Query,
) (db *sql.DB, term func(), err error)

func UseExternalConfig

func UseExternalConfig(
	ctx context.Context,
	cfg *ExternalEnvironmentConfig,
	migrations migrations.Migrations,
	initialQueries ...migrations.Query,
) (db *sql.DB, term func(), err error)

func UseExternalForTesting

func UseExternalForTesting(
	t *testing.T,
	migrations migrations.Migrations,
	initialQueries ...migrations.Query,
) *sql.DB

func UseExternalForTestingConfig

func UseExternalForTestingConfig(
	t *testing.T,
	cfg *ExternalEnvironmentConfig,
	migrations migrations.Migrations,
	initialQueries ...migrations.Query,
) *sql.DB

Types

type Environment

type Environment interface {
	Connect(ctx context.Context, args ...string) (*sql.DB, error)
	Terminate(ctx context.Context) error
}

type ExternalEnvironmentConfig

type ExternalEnvironmentConfig struct {
	DriverName       string
	ConnectionString string
}

type ProvideEnvironmentFunc

type ProvideEnvironmentFunc func(ctx context.Context) (Environment, error)

type Reusable

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

func ExternalReusable

func ExternalReusable() *Reusable

func NewReusable

func NewReusable(ccf ProvideEnvironmentFunc, opts ...ReusableOption) *Reusable

func (*Reusable) Terminate

func (r *Reusable) Terminate(ctx context.Context) error

type ReusableOption

type ReusableOption func(r *Reusable)

func WithWaitDuration

func WithWaitDuration(duration time.Duration) ReusableOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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