diff --git a/structs/storage/article.go b/structs/storage/article.go index 759a866..ae51ef3 100644 --- a/structs/storage/article.go +++ b/structs/storage/article.go @@ -10,6 +10,7 @@ import ( type ArticleApi interface { Upsert(article v2.Article) error + Update(article v2.Article, selects ...string) error Find(query *FindArticleQuery) (articles []v2.Article, err error) List(query PageListQuery) (articles []v2.Article, total int64, err error) Get(query *GetArticleQuery) (article v2.Article, err error) @@ -48,6 +49,13 @@ func (a *articleApi) Upsert(article v2.Article) error { } +func (a *articleApi) Update(article v2.Article, selects ...string) error { + if len(selects) > 0 { + selects = []string{"remark", "exclude"} + } + return a.db.Model(&article).Select(selects).Updates(article).Error +} + // ******************Findĺ’ŚList type FindArticleQuery struct {