ListByUserID returns all sessions for a user.
(ctx context.Context, userID string)
| 182 | |
| 183 | // ListByUserID returns all sessions for a user. |
| 184 | func (s *SessionsStore) ListByUserID(ctx context.Context, userID string) ([]models.UserSession, error) { |
| 185 | d := s.db.DB(ctx) |
| 186 | rows, err := d.Queries.ListSessionsByUserID(ctx, userID) |
| 187 | if err != nil { |
| 188 | return nil, err |
| 189 | } |
| 190 | out := make([]models.UserSession, len(rows)) |
| 191 | for i := range rows { |
| 192 | out[i] = dbUserSessionToModel(rows[i]) |
| 193 | } |
| 194 | return out, nil |
| 195 | } |
| 196 | |
| 197 | // RevokeByID revokes a session by ID. |
| 198 | func (s *SessionsStore) RevokeByID(ctx context.Context, id, userID string) error { |
no test coverage detected