From cfd5a77e713c1c5a34f87fa1a94fa81fc5394a81 Mon Sep 17 00:00:00 2001 From: timerzz Date: Wed, 11 Sep 2024 17:51:59 +0800 Subject: [PATCH] =?UTF-8?q?feat=20article=E6=B7=BB=E5=8A=A0create?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- structs/storage/article.go | 5 +++++ 1 file changed, 5 insertions(+) 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 {