(ctx context.Context, requestID string, patch RequestPatch)
| 103 | } |
| 104 | |
| 105 | func (s *sqliteStore) UpdateRequest(ctx context.Context, requestID string, patch RequestPatch) error { |
| 106 | r, err := s.GetRequest(ctx, requestID) |
| 107 | if err != nil { |
| 108 | return err |
| 109 | } |
| 110 | if patch.Status != nil { |
| 111 | r.Status = *patch.Status |
| 112 | } |
| 113 | if patch.SelectedBackend != nil { |
| 114 | r.SelectedBackend = *patch.SelectedBackend |
| 115 | } |
| 116 | if patch.RouteReason != nil { |
| 117 | r.RouteReason = *patch.RouteReason |
| 118 | } |
| 119 | if patch.PolicySnapshot != nil { |
| 120 | r.PolicySnapshot = append([]byte(nil), patch.PolicySnapshot...) |
| 121 | } |
| 122 | if !patch.UpdatedAt.IsZero() { |
| 123 | r.UpdatedAt = patch.UpdatedAt |
| 124 | } |
| 125 | _, err = s.db.ExecContext(ctx, ` |
| 126 | UPDATE requests SET |
| 127 | policy_snapshot_json = ?, |
| 128 | status = ?, |
| 129 | selected_backend = ?, |
| 130 | route_reason = ?, |
| 131 | updated_at = ? |
| 132 | WHERE request_id = ?`, |
| 133 | string(r.PolicySnapshot), r.Status, r.SelectedBackend, r.RouteReason, r.UpdatedAt.UnixMilli(), requestID, |
| 134 | ) |
| 135 | return err |
| 136 | } |
| 137 | |
| 138 | func (s *sqliteStore) AppendStep(ctx context.Context, step StepRow) error { |
| 139 | _, err := s.db.ExecContext(ctx, ` |
nothing calls this directly
no test coverage detected