Function I/O
| Name | In | Out | Side | Purpose |
|---|---|---|---|---|
| SELECT_invite_for_update | code | InviteCodeRow | nil | lock | Locks the invite row for the duration of the transaction. |
| INSERT_users | userRow | userId | write | Persists the new account. |
| UPDATE_invite_consumed | code, now | rows_affected | write | Marks the invite as consumed. |
Variables
| Name | Type | Scope | Purpose |
|---|---|---|---|
| users.email | text | persist | Unique account identity. |
| invite_codes.consumed_at | timestamptz | persist | Timestamp set the moment the invite row is consumed. |
Internal data flow
Errors
| Name | When | Means |
|---|---|---|
| ErrUniqueEmail | users.email unique constraint violated. | Bubble up so service can return ErrEmailTaken. |