MCPcopy Index your code
hub / github.com/InferCore/InferCore / UpdateRequest

Method UpdateRequest

internal/requests/postgres.go:91–122  ·  view source on GitHub ↗
(ctx context.Context, requestID string, patch RequestPatch)

Source from the content-addressed store, hash-verified

89}
90
91func (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, `
112UPDATE requests SET
113 policy_snapshot_json = $1,
114 status = $2,
115 selected_backend = $3,
116 route_reason = $4,
117 updated_at = $5
118WHERE request_id = $6`,
119 string(r.PolicySnapshot), r.Status, r.SelectedBackend, r.RouteReason, r.UpdatedAt.UnixMilli(), requestID,
120 )
121 return err
122}
123
124func (s *postgresStore) AppendStep(ctx context.Context, step StepRow) error {
125 _, err := s.db.ExecContext(ctx, `

Callers

nothing calls this directly

Calls 1

GetRequestMethod · 0.95

Tested by

no test coverage detected