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