common/structs/storage/storage.go
2024-08-27 16:39:06 +08:00

37 lines
691 B
Go

package storage
import "gorm.io/gorm"
type Storage struct {
articleApi ArticleApi
providerApi ProviderApi
providerArticleApi ProviderArticleApi
sellerApi SellerApi
sellerArticleApi SellerArticleApi
}
func NewStorage(db *gorm.DB) *Storage {
return &Storage{
articleApi: &articleApi{
db: db,
},
providerApi: NewProviderApi(db),
sellerApi: NewSellerApi(db),
}
}
func (s *Storage) Article() ArticleApi {
return s.articleApi
}
func (s *Storage) Provider() ProviderApi {
return s.providerApi
}
func (s *Storage) ProviderArticle() ProviderArticleApi {
return s.providerArticleApi
}
func (s *Storage) Seller() SellerApi {
return s.sellerApi
}