( ctx context.Context, chatID uuid.UUID, pullRequestURL string, staleAt time.Time, )
| 4203 | } |
| 4204 | |
| 4205 | func (api *API) upsertChatDiffStatusReference( |
| 4206 | ctx context.Context, |
| 4207 | chatID uuid.UUID, |
| 4208 | pullRequestURL string, |
| 4209 | staleAt time.Time, |
| 4210 | ) (database.ChatDiffStatus, error) { |
| 4211 | status, err := api.Database.UpsertChatDiffStatusReference( |
| 4212 | ctx, |
| 4213 | database.UpsertChatDiffStatusReferenceParams{ |
| 4214 | ChatID: chatID, |
| 4215 | Url: sql.NullString{ |
| 4216 | String: pullRequestURL, |
| 4217 | Valid: strings.TrimSpace(pullRequestURL) != "", |
| 4218 | }, |
| 4219 | // Empty strings preserve existing values via the |
| 4220 | // CASE expression in the SQL query. |
| 4221 | GitBranch: "", |
| 4222 | GitRemoteOrigin: "", |
| 4223 | StaleAt: staleAt, |
| 4224 | }, |
| 4225 | ) |
| 4226 | if err != nil { |
| 4227 | return database.ChatDiffStatus{}, xerrors.Errorf("upsert chat diff status reference: %w", err) |
| 4228 | } |
| 4229 | return status, nil |
| 4230 | } |
| 4231 | |
| 4232 | func (api *API) getCachedChatDiffStatus( |
| 4233 | ctx context.Context, |
no test coverage detected