--- User management ---
(ctx context.Context, email, name, googleSub string)
| 3040 | // --- User management --- |
| 3041 | |
| 3042 | func (s *Store) CreateOrGetUser(ctx context.Context, email, name, googleSub string) (*User, error) { |
| 3043 | u := &User{} |
| 3044 | err := s.pool.QueryRow(ctx, |
| 3045 | `INSERT INTO users (id, email, name, google_subject) |
| 3046 | VALUES ($1, $2, $3, $4) |
| 3047 | ON CONFLICT (google_subject) DO UPDATE SET email = EXCLUDED.email, name = EXCLUDED.name |
| 3048 | RETURNING id, email, name, google_subject, created_at`, |
| 3049 | generateID(), email, name, googleSub, |
| 3050 | ).Scan(&u.ID, &u.Email, &u.Name, &u.GoogleSubject, &u.CreatedAt) |
| 3051 | if err != nil { |
| 3052 | return nil, err |
| 3053 | } |
| 3054 | return u, nil |
| 3055 | } |
| 3056 | |
| 3057 | // SetAccountClass sets a user's account_class (standard|internal|system|demo). |
| 3058 | // Used by the prober's seed to mark the synthetic probe account as system so its |