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

Method GetRequest

internal/requests/postgres.go:142–170  ·  view source on GitHub ↗
(ctx context.Context, requestID string)

Source from the content-addressed store, hash-verified

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

Callers 2

UpdateRequestMethod · 0.95
ListStepsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected