model.go 517 B

12345678910111213141516171819202122
  1. package yb_config
  2. import "hongze/hongze_yb/global"
  3. func (m *YbConfig) Create() (err error) {
  4. err = global.DEFAULT_MYSQL.Create(m).Error
  5. return
  6. }
  7. func (m *YbConfig) Update(cols string) (err error) {
  8. err = global.DEFAULT_MYSQL.Model(m).Select(cols).Updates(*m).Error
  9. return
  10. }
  11. func (m *YbConfig) Delete() (err error) {
  12. return
  13. }
  14. func (m *YbConfig) Fetch(condition string, pars []interface{}) (item *YbConfig, err error) {
  15. err = global.DEFAULT_MYSQL.Model(m).Where(condition, pars).First(&item).Error
  16. return
  17. }