Skip to content

Commit

Permalink
Update types
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyhb committed Sep 16, 2024
1 parent afcda48 commit d9caa3c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/replicator/pgreplicator/initializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"github.com/jackc/pgx/v5"
)

type InitializeResult = pgsetup.TestConnResult

type InitializerOpts struct {
// AdminConfig are admin credentials to verify DB config, eg. replication slots, publications,
// wal mode, etc.
Expand All @@ -17,7 +19,7 @@ type InitializerOpts struct {
Password string
}

func NewInitializer(ctx context.Context, opts InitializerOpts) replicator.SystemInitializer[pgsetup.TestConnResult] {
func NewInitializer(ctx context.Context, opts InitializerOpts) replicator.SystemInitializer[InitializeResult] {
// TODO: Immediatey

return initializer[pgsetup.TestConnResult]{opts: opts}
Expand All @@ -28,15 +30,15 @@ type initializer[T pgsetup.TestConnResult] struct {
}

// PerformInit perform setup for the replicator.
func (i initializer[T]) PerformInit(ctx context.Context) (pgsetup.TestConnResult, error) {
func (i initializer[T]) PerformInit(ctx context.Context) (InitializeResult, error) {
return pgsetup.Setup(ctx, pgsetup.SetupOpts{
AdminConfig: i.opts.AdminConfig,
Password: i.opts.Password,
})
}

// CheckInit checks setup for the replicator.
func (i initializer[T]) CheckInit(ctx context.Context) (pgsetup.TestConnResult, error) {
func (i initializer[T]) CheckInit(ctx context.Context) (InitializeResult, error) {
return pgsetup.Check(ctx, pgsetup.SetupOpts{
AdminConfig: i.opts.AdminConfig,
Password: i.opts.Password,
Expand Down

0 comments on commit d9caa3c

Please sign in to comment.