GetUserRole 获取用户的角色信息
(ctx context.Context, userId int)
| 77 | |
| 78 | // GetUserRole 获取用户的角色信息 |
| 79 | func (r *roleRepository) GetUserRole(ctx context.Context, userId int) (*domain.Role, error) { |
| 80 | role, err := r.dao.GetUserRole(ctx, userId) |
| 81 | if err != nil { |
| 82 | return nil, err |
| 83 | } |
| 84 | if role == nil { |
| 85 | return nil, nil |
| 86 | } |
| 87 | return r.roleFromDAO(role), nil |
| 88 | } |
| 89 | |
| 90 | // roleToDAO 将领域模型转换为DAO模型 |
| 91 | func (r *roleRepository) roleToDAO(role *domain.Role) *dao.Role { |
nothing calls this directly
no test coverage detected