diff --git a/structs/storage/storage.go b/structs/storage/storage.go index 5470b92..9fe613f 100644 --- a/structs/storage/storage.go +++ b/structs/storage/storage.go @@ -3,6 +3,7 @@ package storage import "gorm.io/gorm" type Storage struct { + db *gorm.DB articleApi ArticleApi providerApi ProviderApi providerArticleApi ProviderArticleApi @@ -12,6 +13,7 @@ type Storage struct { func NewStorage(db *gorm.DB) *Storage { return &Storage{ + db: db, articleApi: NewArticleApi(db), providerApi: NewProviderApi(db), providerArticleApi: NewProviderArticleApi(db), @@ -20,6 +22,9 @@ func NewStorage(db *gorm.DB) *Storage { } } +func (s *Storage) DB() *gorm.DB { + return s.db +} func (s *Storage) Article() ArticleApi { return s.articleApi }