Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ebrick.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func NewApplication(opts ...Option) Application {
module.WithLogger(options.Logger),
module.WithCache(options.Cache),
module.WithEventBus(options.EventBus),
module.WithDB(options.DB),
)

app := &application{
Expand Down
8 changes: 8 additions & 0 deletions module/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import (
"github.com/ebrickdev/ebrick/cache"
"github.com/ebrickdev/ebrick/logger"
"github.com/ebrickdev/ebrick/messaging"
"gorm.io/gorm"
)

type Options struct {
Cache cache.Cache
Logger logger.Logger
EventBus messaging.EventBus
Db *gorm.DB
}

type Option func(*Options)
Expand Down Expand Up @@ -41,3 +43,9 @@ func WithEventBus(e messaging.EventBus) Option {
o.EventBus = e
}
}

func WithDB(db *gorm.DB) Option {
return func(o *Options) {
o.Db = db
}
}