You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bf021ca
Browse filesBrowse the repository at this point in the historyBrowse files
feat(postgres): add TransactionAwareAggregateRepository for unit-of-work pattern (#369)
This PR adds `TransactionAwareAggregateRepository` to `postgres`
package, for caller-owned transactions (e.g. Unit of Work pattern).
`TransactionAwareAggregateRepository` implements `aggregate.Repository`
without requiring a connection pool.
Instead, it expects a `pgx.Tx` be injected into context, and requires
specifying the function to fetch the `pgx.Tx` from context.
```go
repository := postgres.NewTransactionAwareAggregateRepository(
unitofwork.TxFromContext,
AggregateType,
aggregateSerde,
messageSerde,
postgres.WithAggregateTableName[ID, *Root]("aggregates"),
)
```
0 commit comments