common/structs/storage/storage.go

36 lines
752 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: NewArticleApi(db),
providerApi: NewProviderApi(db),
providerArticleApi: NewProviderArticleApi(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
}