golang 的 rabbitmq 消费项目
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.

dbs_user.go 951 B

2 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package db
  2. import (
  3. "xorm.io/xorm"
  4. "applet/app/db/model"
  5. "applet/app/utils/logx"
  6. )
  7. func DbsUser(eg *xorm.Engine, uid int) (*[]model.UserRelate, error) {
  8. var userRelate []model.UserRelate
  9. if err := eg.Where("uid = ?", uid).Asc("level").Find(&userRelate); err != nil {
  10. return nil, logx.Error(err)
  11. }
  12. if len(userRelate) == 0 {
  13. return nil, nil
  14. }
  15. return &userRelate, nil
  16. }
  17. func DbsUserFindByIds(eg *xorm.Engine, uid []int) (*[]model.User, error) {
  18. var users []model.User
  19. if err := eg.In("uid", uid).Asc("level").Find(&users); err != nil {
  20. return nil, logx.Error(err)
  21. }
  22. if len(users) == 0 {
  23. return nil, nil
  24. }
  25. return &users, nil
  26. }
  27. func DbsUserRelate(eg *xorm.Engine, uid int) (*[]model.UserRelate, error) {
  28. var userRelate []model.UserRelate
  29. if err := eg.Where("uid = ?", uid).Asc("level").Find(&userRelate); err != nil {
  30. return nil, logx.Error(err)
  31. }
  32. if len(userRelate) == 0 {
  33. return nil, nil
  34. }
  35. return &userRelate, nil
  36. }