feat storage 添加db方法

This commit is contained in:
timerzz 2024-09-02 16:12:22 +08:00
parent 1290c1e1fd
commit 06e03d4f50

View File

@ -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
}