Documentation ¶
Index ¶
- Constants
- type Config
- type Driver
- func (d *Driver) Close(ctx context.Context) error
- func (d *Driver) Connect(ctx context.Context) error
- func (d *Driver) GetDB() *sqlx.DB
- func (d *Driver) MigratePostgres(ctx context.Context, migrationsPath string) error
- func (d *Driver) RevertMigrations(ctx context.Context, migrationsPath string) error
Constants ¶
View Source
const ( // ErrDriverInit is returned when we cannot initialize the driver. ErrDriverInit = errors.Error("failed to initialize postgres driver") // ErrMigrateInit is returned when we cannot initialize the migrate driver. ErrMigrateInit = errors.Error("failed to initialize migration driver") // ErrMigration is returned when we cannot run a migration. ErrMigration = errors.Error("failed to migrate database") )
View Source
const ( // ErrConnect is returned when we cannot connect to the database. ErrConnect = errors.Error("failed to connect to postgres db") // ErrClose is returned when we cannot close the database. ErrClose = errors.Error("failed to close postgres db connection") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
DSN string `env:"POSTGRES_DSN" validate:"required"`
}
Config represents the configuration for our postgres database.
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver provides an implementation for connecting to a postgres database.
func (*Driver) MigratePostgres ¶
MigratePostgres migrates the database to the latest version.
Click to show internal directories.
Click to hide internal directories.