feat: initial commit
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package graph
|
||||
|
||||
import (
|
||||
"github.com/apex/log"
|
||||
"gitlab.com/unboundsoftware/eventsourced/eventsourced"
|
||||
|
||||
"gitlab.com/unboundsoftware/schemas/cache"
|
||||
)
|
||||
|
||||
//go:generate go run github.com/99designs/gqlgen
|
||||
|
||||
// This file will not be regenerated automatically.
|
||||
//
|
||||
// It serves as dependency injection for your app, add any dependencies you require here.
|
||||
|
||||
type Publisher interface {
|
||||
Publish(event eventsourced.Event) error
|
||||
Stop() error
|
||||
}
|
||||
|
||||
type Resolver struct {
|
||||
EventStore eventsourced.EventStore
|
||||
Publisher Publisher
|
||||
Logger log.Interface
|
||||
Cache *cache.Cache
|
||||
}
|
||||
|
||||
func (r *Resolver) handler(aggregate eventsourced.Aggregate) (eventsourced.CommandHandler, error) {
|
||||
return eventsourced.NewHandler(aggregate, r.EventStore, eventsourced.WithEventPublisher(r.Publisher))
|
||||
}
|
||||
Reference in New Issue
Block a user