Commit f79ef71
Changed files (2)
pkg
pkg/event/aggregator.go
@@ -18,12 +18,6 @@ func WithDefaults() x.Option[*Aggregator] {
})
}
-func WithSubscriptions(subscriptions map[Event][]Subscription) x.Option[*Aggregator] {
- return x.With(func(item *Aggregator) {
- item.subscriptions = subscriptions
- })
-}
-
func (a *Aggregator) Subscribe(event Event, f Subscription) {
a.mu.Lock()
defer a.mu.Unlock()
pkg/event/typed_aggregator.go
@@ -7,17 +7,11 @@ type TypedAggregator[T any] struct {
}
func New[T any]() *TypedAggregator[T] {
- return NewWith[T](
- x.New(
- WithDefaults(),
- ),
- )
-}
-
-func NewWith[T any](aggregator *Aggregator) *TypedAggregator[T] {
return x.New[*TypedAggregator[T]](
WithAggregator[T](
- aggregator,
+ x.New(
+ WithDefaults(),
+ ),
),
)
}