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

Method ListSteps

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

Source from the content-addressed store, hash-verified

170}
171
172func (s *postgresStore) ListSteps(ctx context.Context, requestID string) ([]StepRow, error) {
173 rows, err := s.db.QueryContext(ctx, `
174SELECT request_id, step_index, step_type, input_json, output_json, backend, status, error, latency_ms, metadata_json
175FROM request_steps WHERE request_id = $1 ORDER BY step_index ASC`, requestID)
176 if err != nil {
177 return nil, err
178 }
179 defer rows.Close()
180 var out []StepRow
181 for rows.Next() {
182 var srow StepRow
183 var inJ, outJ, metaJ sql.NullString
184 if err := rows.Scan(&srow.RequestID, &srow.StepIndex, &srow.StepType, &inJ, &outJ, &srow.Backend, &srow.Status, &srow.Error, &srow.LatencyMs, &metaJ); err != nil {
185 return nil, err
186 }
187 if inJ.Valid {
188 srow.InputJSON = []byte(inJ.String)
189 }
190 if outJ.Valid {
191 srow.OutputJSON = []byte(outJ.String)
192 }
193 if metaJ.Valid {
194 srow.MetadataJSON = []byte(metaJ.String)
195 }
196 out = append(out, srow)
197 }
198 if err := rows.Err(); err != nil {
199 return nil, err
200 }
201 if len(out) == 0 {
202 if _, err := s.GetRequest(ctx, requestID); err != nil {
203 return nil, err
204 }
205 }
206 return out, nil
207}
208
209func (s *postgresStore) Close() error {
210 return s.db.Close()

Callers

nothing calls this directly

Calls 2

GetRequestMethod · 0.95
CloseMethod · 0.65

Tested by

no test coverage detected