MCPcopy Create free account
hub / github.com/InferCore/InferCore / CreateRequest

Method CreateRequest

internal/requests/postgres.go:70–82  ·  view source on GitHub ↗
(ctx context.Context, row RequestRow)

Source from the content-addressed store, hash-verified

68}
69
70func (s *postgresStore) CreateRequest(ctx context.Context, row RequestRow) error {
71 _, err := s.db.ExecContext(ctx, `
72INSERT INTO requests (
73 request_id, trace_id, request_type, tenant_id, task_type, priority, pipeline_ref,
74 input_json, context_json, ai_request_json, policy_snapshot_json, status, selected_backend, route_reason,
75 created_at, updated_at
76) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16)`,
77 row.RequestID, row.TraceID, row.RequestType, row.TenantID, row.TaskType, row.Priority, row.PipelineRef,
78 string(row.InputJSON), string(row.ContextJSON), nullIfEmpty(row.AIRequestJSON), string(row.PolicySnapshot), row.Status, row.SelectedBackend, row.RouteReason,
79 row.CreatedAt.UnixMilli(), row.UpdatedAt.UnixMilli(),
80 )
81 return err
82}
83
84func nullIfEmpty(b []byte) interface{} {
85 if len(b) == 0 {

Callers

nothing calls this directly

Calls 1

nullIfEmptyFunction · 0.85

Tested by

no test coverage detected