Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Module = fx.Options( fx.Provide(func(lc fx.Lifecycle, cfg *Config) (Driver, error) { driver, err := postgres.New(context.Background(), cfg.URL) if err != nil { return nil, err } lc.Append(fx.Hook{ OnStart: func(ctx context.Context) error { return driver.Ping(ctx) }, OnStop: func(context.Context) error { driver.Close() return nil }, }) return driver, nil }), fx.Provide(NewMigrationsRunner), )
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver interface { Ping(ctx context.Context) error Close() CountRows(ctx context.Context, query string, args ...interface{}) (int, error) ExecuteQuery(ctx context.Context, query string, args ...interface{}) error QueryRow(ctx context.Context, query string, args ...interface{}) (pgx.Row, error) QueryRows(ctx context.Context, query string, args ...interface{}) (pgx.Rows, error) }
type MigrationsRunner ¶
type MigrationsRunner struct {
// contains filtered or unexported fields
}
func NewMigrationsRunner ¶
func NewMigrationsRunner(config *Config, logger *zap.Logger, shutdowner fx.Shutdowner) *MigrationsRunner
func (*MigrationsRunner) MigrateDown ¶
func (r *MigrationsRunner) MigrateDown() error
func (*MigrationsRunner) MigrateUp ¶
func (r *MigrationsRunner) MigrateUp() error
Click to show internal directories.
Click to hide internal directories.