update.go 308 B

123456789101112
  1. package research_report
  2. import (
  3. "gorm.io/gorm"
  4. "hongze/hongze_yb/global"
  5. )
  6. // UpdateViewers 更新对应字段数据
  7. func (researchReport *ResearchReport) UpdateViewers() (err error) {
  8. err = global.DEFAULT_MYSQL.Model(researchReport).UpdateColumn("viewers", gorm.Expr("viewers + ?", 1)).Error
  9. return
  10. }