diff --git a/structs/storage/article.go b/structs/storage/article.go index 5c4192d..82f73fe 100644 --- a/structs/storage/article.go +++ b/structs/storage/article.go @@ -9,6 +9,7 @@ import ( ) type ArticleApi interface { + Create(article *v2.Article) error Upsert(article v2.Article) error Update(article v2.Article, selects ...string) error Find(query *FindArticleQuery) (articles []v2.Article, err error) @@ -27,6 +28,10 @@ func NewArticleApi(db *gorm.DB) ArticleApi { } } +func (a *articleApi) Create(article *v2.Article) error { + return a.db.Create(article).Error +} + // Upsert 插入或者更新商品 func (a *articleApi) Upsert(article v2.Article) error { return a.db.Transaction(func(tx *gorm.DB) error {