Documentation ¶
Index ¶
- Constants
- func ApplyFixtures(ctx context.Context, conn *sql.DB, fixtureFiles []string, uri string) error
- func Instances(ctx context.Context) ([]database.Info, error)
- func RunMigrations(ctx context.Context, conn *sql.DB, migrationsFiles []string, uri string) error
- type Option
- type Postgres
- func (p *Postgres) ContainerID() string
- func (p *Postgres) CreateDB(ctx context.Context, req *database.CreateDBRequest) (*database.CreateDBResponse, error)
- func (p *Postgres) RemoveDB(ctx context.Context, uri string) error
- func (p *Postgres) Start(ctx context.Context, detach bool) error
- func (p *Postgres) Stop(ctx context.Context) error
- func (p *Postgres) URI() string
- func (p *Postgres) WaitForStart(ctx context.Context, timeout time.Duration) error
Constants ¶
View Source
const ( // DefaultPort is the default port for postgres DefaultPort = 15432 // DefaultUser is the default user for postgres DefaultUser = "postgres" // DefaultPass is the default password for postgres DefaultPass = "postgres" // DefaultName is the default database name for postgres DefaultName = "postgres" // DefaultTemplate is the default template name for postgres when creating a new database with migtations and fixtures DefaultTemplate = "dbctl_template" )
Variables ¶
This section is empty.
Functions ¶
func ApplyFixtures ¶
ApplyFixtures applies fixtures on a postgres database
Types ¶
type Option ¶
type Option func(*config) error
Option is the type of the functional options for the postgres
func WithFixtures ¶
WithFixtures applied selected fixtures to config
func WithLogger ¶
WithLogger applied selected logger to config
func WithMigrations ¶
WithMigrations applied selected migrations to config
func WithVersion ¶
WithVersion applied selected postgres version to config
type Postgres ¶
type Postgres struct {
// contains filtered or unexported fields
}
Postgres is a postgres database instance
func (*Postgres) ContainerID ¶ added in v0.5.0
func (*Postgres) CreateDB ¶ added in v0.4.0
func (p *Postgres) CreateDB(ctx context.Context, req *database.CreateDBRequest) (*database.CreateDBResponse, error)
CreateDB creates a new database with given migrations and fixtures
Click to show internal directories.
Click to hide internal directories.