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

Method CreateOrGetUser

internal/identity/store.go:3042–3055  ·  view source on GitHub ↗

--- User management ---

(ctx context.Context, email, name, googleSub string)

Source from the content-addressed store, hash-verified

3040// --- User management ---
3041
3042func (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

Implementers 1

Storeinternal/identity/store.go

Calls 3

generateIDFunction · 0.85
ScanMethod · 0.80
QueryRowMethod · 0.80