feat provider-article添加AutoMrigate
This commit is contained in:
parent
a6be6c7cba
commit
55f4cbdd6b
@ -10,6 +10,7 @@ import (
|
|||||||
type ProviderArticleApi interface {
|
type ProviderArticleApi interface {
|
||||||
Get(query GetProviderArticleQuery) (article v2.ProviderArticle, err error)
|
Get(query GetProviderArticleQuery) (article v2.ProviderArticle, err error)
|
||||||
Upsert(article v2.ProviderArticle) error
|
Upsert(article v2.ProviderArticle) error
|
||||||
|
AutoMigrate() error
|
||||||
}
|
}
|
||||||
|
|
||||||
type providerArticleApi struct {
|
type providerArticleApi struct {
|
||||||
@ -58,3 +59,7 @@ func (p *providerArticleApi) Upsert(article v2.ProviderArticle) error {
|
|||||||
DoUpdates: clause.AssignmentColumns([]string{"cost"}),
|
DoUpdates: clause.AssignmentColumns([]string{"cost"}),
|
||||||
}).Create(&article).Error
|
}).Create(&article).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *providerArticleApi) AutoMigrate() error {
|
||||||
|
return p.db.AutoMigrate(&v2.ProviderArticle{})
|
||||||
|
}
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
type SellerArticleApi interface {
|
type SellerArticleApi interface {
|
||||||
Get(query GetProviderArticleQuery) (article v2.ProviderArticle, err error)
|
Get(query GetProviderArticleQuery) (article v2.ProviderArticle, err error)
|
||||||
Upsert(article v2.SellerArticle) error
|
Upsert(article v2.SellerArticle) error
|
||||||
|
AutoMigrate() error
|
||||||
}
|
}
|
||||||
|
|
||||||
type sellerArticleApi struct {
|
type sellerArticleApi struct {
|
||||||
@ -54,3 +55,7 @@ func (p *sellerArticleApi) Upsert(article v2.SellerArticle) error {
|
|||||||
DoUpdates: clause.AssignmentColumns([]string{"sell"}),
|
DoUpdates: clause.AssignmentColumns([]string{"sell"}),
|
||||||
}).Create(&article).Error
|
}).Create(&article).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *sellerArticleApi) AutoMigrate() error {
|
||||||
|
return p.db.AutoMigrate(&v2.SellerArticle{})
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user