feat article添加create
This commit is contained in:
parent
cfd5a77e71
commit
93c7391125
@ -37,7 +37,7 @@ func (a *articleApi) Upsert(article v2.Article) error {
|
|||||||
return a.db.Transaction(func(tx *gorm.DB) error {
|
return a.db.Transaction(func(tx *gorm.DB) error {
|
||||||
if err := tx.Clauses(clause.OnConflict{
|
if err := tx.Clauses(clause.OnConflict{
|
||||||
Columns: []clause.Column{{Name: "pid"}, {Name: "brand"}},
|
Columns: []clause.Column{{Name: "pid"}, {Name: "brand"}},
|
||||||
DoUpdates: clause.AssignmentColumns([]string{"name", "english_name", "available", "updated_at", "cost_price", "sell_price", "rate", "remark", "exclude"}),
|
DoUpdates: clause.AssignmentColumns([]string{"available", "updated_at", "cost_price", "sell_price", "rate", "remark", "exclude"}),
|
||||||
}).Create(&article).Error; err != nil {
|
}).Create(&article).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user