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

Method GetRequest

internal/requests/sqlite.go:149–177  ·  view source on GitHub ↗
(ctx context.Context, requestID string)

Source from the content-addressed store, hash-verified

147}
148
149func (s *sqliteStore) GetRequest(ctx context.Context, requestID string) (RequestRow, error) {
150 row := s.db.QueryRowContext(ctx, `
151SELECT request_id, trace_id, request_type, tenant_id, task_type, priority, pipeline_ref,
152 input_json, context_json, ai_request_json, policy_snapshot_json, status, selected_backend, route_reason,
153 created_at, updated_at
154FROM requests WHERE request_id = ?`, requestID)
155 var r RequestRow
156 var createdMs, updatedMs int64
157 var policySnap, aiReq sql.NullString
158 if err := row.Scan(
159 &r.RequestID, &r.TraceID, &r.RequestType, &r.TenantID, &r.TaskType, &r.Priority, &r.PipelineRef,
160 &r.InputJSON, &r.ContextJSON, &aiReq, &policySnap, &r.Status, &r.SelectedBackend, &r.RouteReason,
161 &createdMs, &updatedMs,
162 ); err != nil {
163 if errors.Is(err, sql.ErrNoRows) {
164 return RequestRow{}, ErrNotFound
165 }
166 return RequestRow{}, err
167 }
168 if aiReq.Valid {
169 r.AIRequestJSON = []byte(aiReq.String)
170 }
171 if policySnap.Valid {
172 r.PolicySnapshot = []byte(policySnap.String)
173 }
174 r.CreatedAt = time.UnixMilli(createdMs)
175 r.UpdatedAt = time.UnixMilli(updatedMs)
176 return r, nil
177}
178
179func (s *sqliteStore) ListSteps(ctx context.Context, requestID string) ([]StepRow, error) {
180 rows, err := s.db.QueryContext(ctx, `

Callers 2

UpdateRequestMethod · 0.95
ListStepsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected