(ctx context.Context, requestID string)
| 170 | } |
| 171 | |
| 172 | func (s *postgresStore) ListSteps(ctx context.Context, requestID string) ([]StepRow, error) { |
| 173 | rows, err := s.db.QueryContext(ctx, ` |
| 174 | SELECT request_id, step_index, step_type, input_json, output_json, backend, status, error, latency_ms, metadata_json |
| 175 | FROM 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 | |
| 209 | func (s *postgresStore) Close() error { |
| 210 | return s.db.Close() |
nothing calls this directly
no test coverage detected