From 06e03d4f501a5e6c039267ad95860aa22be3f68f Mon Sep 17 00:00:00 2001 From: timerzz Date: Mon, 2 Sep 2024 16:12:22 +0800 Subject: [PATCH] =?UTF-8?q?feat=20storage=20=E6=B7=BB=E5=8A=A0db=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- structs/storage/storage.go | 5 +++++ 1 file changed, 5 insertions(+) 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 }