Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PGX Subscriber InvalidIfaceAssign #408

Open
TeddyLourson opened this issue Nov 2, 2023 · 2 comments
Open

PGX Subscriber InvalidIfaceAssign #408

TeddyLourson opened this issue Nov 2, 2023 · 2 comments

Comments

@TeddyLourson
Copy link

I'm getting an error when trying to create an SQL subscriber with pgx. I can't find any example of a Postgres subscriber so I've followed the simple MySQL forwarder example to no success.

Here's the code :

func InitSQLSubscriber(db *pgxpool.Pool, logger watermill.LoggerAdapter) (*sql.Subscriber, error) {
	sqlSubscriber, err := sql.NewSubscriber(
		db,
		sql.SubscriberConfig{
			SchemaAdapter:    sql.DefaultPostgreSQLSchema{},
			OffsetsAdapter:   sql.DefaultPostgreSQLOffsetsAdapter{},
			InitializeSchema: true,
		},
		logger,
	)
	if err != nil {
		return nil, fmt.Errorf("could not create subscriber: %s", err)
	}
	return sqlSubscriber, nil
}

The error :

cannot use db (variable of type *pgxpool.Pool) as "github.com/ThreeDotsLabs/watermill-sql/v2/pkg/sql".Beginner value in argument to sql.NewSubscriber: *pgxpool.Pool does not implement "github.com/ThreeDotsLabs/watermill-sql/v2/pkg/sql".Beginner (wrong type for method BeginTx)
have BeginTx(context.Context, pgx.TxOptions) (pgx.Tx, error)
want BeginTx(context.Context, "database/sql".TxOptions) ("database/sql".Tx, error)compilerInvalidIfaceAssign

@amansx
Copy link

amansx commented Feb 29, 2024

Any response to this?

@m110
Copy link
Member

m110 commented Aug 23, 2024

To be addressed in ThreeDotsLabs/watermill-sql#29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants