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

Method UpdateRequest

internal/requests/sqlite.go:105–136  ·  view source on GitHub ↗
(ctx context.Context, requestID string, patch RequestPatch)

Source from the content-addressed store, hash-verified

103}
104
105func (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, `
126UPDATE requests SET
127 policy_snapshot_json = ?,
128 status = ?,
129 selected_backend = ?,
130 route_reason = ?,
131 updated_at = ?
132WHERE request_id = ?`,
133 string(r.PolicySnapshot), r.Status, r.SelectedBackend, r.RouteReason, r.UpdatedAt.UnixMilli(), requestID,
134 )
135 return err
136}
137
138func (s *sqliteStore) AppendStep(ctx context.Context, step StepRow) error {
139 _, err := s.db.ExecContext(ctx, `

Callers

nothing calls this directly

Calls 1

GetRequestMethod · 0.95

Tested by

no test coverage detected