You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

36 lines
748 B

  1. package repo
  2. import (
  3. "egg-im/internal/logic/domain/group/model"
  4. "egg-im/pkg/db"
  5. "egg-im/pkg/gerrors"
  6. "github.com/jinzhu/gorm"
  7. )
  8. type groupComplainDao struct{}
  9. var GroupComplainDao = new(groupComplainDao)
  10. // Get 获取群组信息
  11. func (*groupComplainDao) Get(id int64) (*model.GroupComplain, error) {
  12. var group = model.GroupComplain{Id: id}
  13. err := db.DB.First(&group).Error
  14. if err != nil && err != gorm.ErrRecordNotFound {
  15. return nil, gerrors.WrapError(err)
  16. }
  17. if err == gorm.ErrRecordNotFound {
  18. return nil, nil
  19. }
  20. return &group, nil
  21. }
  22. // Save 插入一条群组
  23. func (*groupComplainDao) Save(group *model.GroupComplain) error {
  24. err := db.DB.Save(&group).Error
  25. if err != nil {
  26. return gerrors.WrapError(err)
  27. }
  28. return nil
  29. }