UpdateUserName persists a new display name on the user row and returns the updated User. Input validation (length, whitespace) is the caller's responsibility — this layer only enforces that the row exists.
(ctx context.Context, userID, name string)
| 3104 | // the caller's responsibility — this layer only enforces that the row |
| 3105 | // exists. |
| 3106 | func (s *Store) UpdateUserName(ctx context.Context, userID, name string) (*User, error) { |
| 3107 | u := &User{} |
| 3108 | err := s.pool.QueryRow(ctx, |
| 3109 | `UPDATE users SET name = $1 WHERE id = $2 |
| 3110 | RETURNING id, email, name, google_subject, created_at`, |
| 3111 | name, userID, |
| 3112 | ).Scan(&u.ID, &u.Email, &u.Name, &u.GoogleSubject, &u.CreatedAt) |
| 3113 | if err != nil { |
| 3114 | return nil, err |
| 3115 | } |
| 3116 | return u, nil |
| 3117 | } |
| 3118 | |
| 3119 | // --- Session management --- |
| 3120 |
no test coverage detected