(ctx context.Context, requestID string, patch RequestPatch)
| 89 | } |
| 90 | |
| 91 | func (s *postgresStore) UpdateRequest(ctx context.Context, requestID string, patch RequestPatch) error { |
| 92 | r, err := s.GetRequest(ctx, requestID) |
| 93 | if err != nil { |
| 94 | return err |
| 95 | } |
| 96 | if patch.Status != nil { |
| 97 | r.Status = *patch.Status |
| 98 | } |
| 99 | if patch.SelectedBackend != nil { |
| 100 | r.SelectedBackend = *patch.SelectedBackend |
| 101 | } |
| 102 | if patch.RouteReason != nil { |
| 103 | r.RouteReason = *patch.RouteReason |
| 104 | } |
| 105 | if patch.PolicySnapshot != nil { |
| 106 | r.PolicySnapshot = append([]byte(nil), patch.PolicySnapshot...) |
| 107 | } |
| 108 | if !patch.UpdatedAt.IsZero() { |
| 109 | r.UpdatedAt = patch.UpdatedAt |
| 110 | } |
| 111 | _, err = s.db.ExecContext(ctx, ` |
| 112 | UPDATE requests SET |
| 113 | policy_snapshot_json = $1, |
| 114 | status = $2, |
| 115 | selected_backend = $3, |
| 116 | route_reason = $4, |
| 117 | updated_at = $5 |
| 118 | WHERE request_id = $6`, |
| 119 | string(r.PolicySnapshot), r.Status, r.SelectedBackend, r.RouteReason, r.UpdatedAt.UnixMilli(), requestID, |
| 120 | ) |
| 121 | return err |
| 122 | } |
| 123 | |
| 124 | func (s *postgresStore) AppendStep(ctx context.Context, step StepRow) error { |
| 125 | _, err := s.db.ExecContext(ctx, ` |
nothing calls this directly
no test coverage detected