|
1234567891011121314151617181920212223242526272829303132333435 |
- package repo
-
- import (
- "gim/internal/logic/domain/group/model"
- "gim/pkg/db"
- "gim/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
- }
|