package repo import ( "egg-im/internal/logic/domain/group/model" "egg-im/pkg/db" "egg-im/pkg/gerrors" "github.com/jinzhu/gorm" ) type groupComplainDao struct{} var GroupComplainDao = new(groupComplainDao) // Get 获取群组信息 func (*groupComplainDao) Get(id int64) (*model.GroupComplain, error) { var group = model.GroupComplain{Id: id} err := db.DB.First(&group).Error if err != nil && err != gorm.ErrRecordNotFound { return nil, gerrors.WrapError(err) } if err == gorm.ErrRecordNotFound { return nil, nil } return &group, nil } // Save 插入一条群组 func (*groupComplainDao) Save(group *model.GroupComplain) error { err := db.DB.Save(&group).Error if err != nil { return gerrors.WrapError(err) } return nil }