MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / GetUserSession

Method GetUserSession

internal/identity/store.go:3136–3147  ·  view source on GitHub ↗
(ctx context.Context, token string)

Source from the content-addressed store, hash-verified

3134}
3135
3136func (s *Store) GetUserSession(ctx context.Context, token string) (*User, error) {
3137 u := &User{}
3138 err := s.pool.QueryRow(ctx,
3139 `SELECT u.id, u.email, u.name, u.google_subject, u.created_at
3140 FROM user_sessions s JOIN users u ON s.user_id = u.id
3141 WHERE s.token = $1 AND s.expires_at > now()`, token,
3142 ).Scan(&u.ID, &u.Email, &u.Name, &u.GoogleSubject, &u.CreatedAt)
3143 if err != nil {
3144 return nil, err
3145 }
3146 return u, nil
3147}
3148
3149func (s *Store) DeleteUserSession(ctx context.Context, token string) error {
3150 _, err := s.pool.Exec(ctx, `DELETE FROM user_sessions WHERE token = $1`, token)

Implementers 1

Storeinternal/identity/store.go

Calls 2

ScanMethod · 0.80
QueryRowMethod · 0.80