MCPcopy Create free account
hub / github.com/PatchMon/PatchMon / ListByUserID

Method ListByUserID

server-source-code/internal/store/sessions.go:184–195  ·  view source on GitHub ↗

ListByUserID returns all sessions for a user.

(ctx context.Context, userID string)

Source from the content-addressed store, hash-verified

182
183// ListByUserID returns all sessions for a user.
184func (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.
198func (s *SessionsStore) RevokeByID(ctx context.Context, id, userID string) error {

Callers 2

GetMethod · 0.45
GetSessionsMethod · 0.45

Calls 3

dbUserSessionToModelFunction · 0.85
DBMethod · 0.65
ListSessionsByUserIDMethod · 0.65

Tested by

no test coverage detected