golang-im聊天
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.

im_package_dao.go 538 B

2 years ago
12345678910111213141516171819202122232425
  1. package repo
  2. import (
  3. "gim/internal/business/domain/user/model"
  4. "gim/pkg/db"
  5. "gim/pkg/gerrors"
  6. "github.com/jinzhu/gorm"
  7. )
  8. type imPackageDao struct{}
  9. var ImPackageDao = new(imPackageDao)
  10. // Get 获取套餐包详情
  11. func (*imPackageDao) Get(id int64) (*model.ImPackage, error) {
  12. var imPackage = model.ImPackage{Id: id}
  13. err := db.DB.First(&imPackage).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 &imPackage, err
  21. }