database

package
v0.0.0-...-a4c5897 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2021 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConnection

func NewConnection(uri string, config Config) (*sql.DB, error)

Types

type Config

type Config struct {
	// The Directory Path of the database migrations.  If this is set,
	// the database will be automatically migrated when generating a
	// new connection.
	MigrationsDir string
}

type ConnectionInfo

type ConnectionInfo struct {
	Host         string
	Port         string
	User         string
	Password     string
	DatabaseName string
	SSLMode      string
}

func (ConnectionInfo) ToURI

func (c ConnectionInfo) ToURI() string

type EphemeralDatabase

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

EphemeralDatabase represents

func NewEphemeralDatabase

func NewEphemeralDatabase(bootstrapConnection ConnectionInfo, config Config) (*EphemeralDatabase, error)

func NewTestEphemeralDatabase

func NewTestEphemeralDatabase(config Config) (*EphemeralDatabase, error)

NewTestDatabase returns an *EphemeralDatabase spun up against our TEST_POSTGRES environment variables, which centralizes this config & simplifies our test code.

func (*EphemeralDatabase) Connection

func (e *EphemeralDatabase) Connection() *sql.DB

Connection returns a reference to the connection to the ephemeral database

func (*EphemeralDatabase) Terminate

func (e *EphemeralDatabase) Terminate() error

Terminate entirely deletes the ephemeral database, and also closes out the connection.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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