(ctx context.Context, requestID string)
| 147 | } |
| 148 | |
| 149 | func (s *sqliteStore) GetRequest(ctx context.Context, requestID string) (RequestRow, error) { |
| 150 | row := s.db.QueryRowContext(ctx, ` |
| 151 | SELECT 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 |
| 154 | FROM 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 | |
| 179 | func (s *sqliteStore) ListSteps(ctx context.Context, requestID string) ([]StepRow, error) { |
| 180 | rows, err := s.db.QueryContext(ctx, ` |
no outgoing calls
no test coverage detected