v4.0.0
Major version bump (v4)
Breaking changes
Schema & Offsets adapters interfaces
- Reworked the
SchemaAdapterandOffsetsAdapterinterfaces (Breaking change -> will bump the major to v4).- We had a few instances where some details have been missing from one of the interface methods. It makes it difficult to extend this library with new features, as each will require a major version bump, and we want to avoid it if possible.
- To mitigate this, we're moving to a
paramsstruct passed to the methods instead of raw arguments. It adds some verbosity but allows extending the params if needed with no breaking changes to the library. - The methods now also return errors.
Migration: if you don't use a custom schema/offsets adapter, you don't need to do anything. If you do, change the methods to implement the new interfaces. Use values from the params argument and return errors.
Beginner accepted in place of *sql.DB
watermill-sql now supports any SQL connection, not just *sql.DB. For example, you can use pgx handle and transactions.
Migration: You need to wrap your db connection with a new constructor when passing it to NewSubscriber and NewPublisher: sql.BeginnerFromStdSQL(db)
See the example:
subscriber, err := sql.NewSubscriber(
sql.BeginnerFromStdSQL(db),
sql.SubscriberConfig{
SchemaAdapter: sql.DefaultMySQLSchema{},
OffsetsAdapter: sql.DefaultMySQLOffsetsAdapter{},
InitializeSchema: true,
},
logger,
)
publisher, err := sql.NewPublisher(
sql.BeginnerFromStdSQL(db),
sql.PublisherConfig{
SchemaAdapter: sql.DefaultMySQLSchema{},
},
logger,
)What's Changed
- Add PostgreSQLQueue and DelayedPostgreSQL Pub/Sub by @m110 in #34
- fix comment formatting by @roblaszczak in #41
- Bump golang.org/x/crypto from 0.20.0 to 0.31.0 by @dependabot[bot] in #40
- streamline the database interfaces and add pgx adapter by @julesjcraske in #29
- Bump pgx to v5.7.2 and update transactionID type to pgtype.Uint64 by @Abdullah-AlAttar in #43
- Add missing TxFromPgx by @m110 in #42
- Make subscriber close safe to concurrently close by @jjcollinge in #44
- Add xid8 by @m110 in #45
- Fix logger error fields not clearing in the Subscriber consume method by @petergere in #49
- Fix validation of subscriber ack deadline by @edebernis in #50
- Bump golang.org/x/crypto from 0.31.0 to 0.35.0 by @dependabot[bot] in #48
- Fix performance and tests by @m110 in #46
- Publish context by @rhhammond in #47
New Contributors
- @julesjcraske made their first contribution in #29
- @Abdullah-AlAttar made their first contribution in #43
- @jjcollinge made their first contribution in #44
- @petergere made their first contribution in #49
- @edebernis made their first contribution in #50
- @rhhammond made their first contribution in #47
Full Changelog: v3.1.0...v4.0.0