feat ArticleApi添加AutoMigrate
This commit is contained in:
parent
14abeb24b5
commit
e82ee959ed
@ -11,6 +11,7 @@ type ArticleApi interface {
|
|||||||
Find(query *FindArticleQuery) (articles []v2.Article, err error)
|
Find(query *FindArticleQuery) (articles []v2.Article, err error)
|
||||||
List(query PageListQuery) (articles []v2.Article, total int64, err error)
|
List(query PageListQuery) (articles []v2.Article, total int64, err error)
|
||||||
Get(query *GetArticleQuery) (article v2.Article, err error)
|
Get(query *GetArticleQuery) (article v2.Article, err error)
|
||||||
|
AutoMigrate() error
|
||||||
}
|
}
|
||||||
|
|
||||||
type articleApi struct {
|
type articleApi struct {
|
||||||
@ -150,3 +151,7 @@ func (a *articleApi) Get(query *GetArticleQuery) (article v2.Article, err error)
|
|||||||
err = a.db.Scopes(query.Scope).First(&article).Error
|
err = a.db.Scopes(query.Scope).First(&article).Error
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *articleApi) AutoMigrate() error {
|
||||||
|
return a.db.AutoMigrate(&v2.Article{})
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user