mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore!: remove coder agents insights page (#26457)
Removes the coder agents PR Insights page (`/agents/settings/insights`) and all of its backend support. The page had previously been hidden and was only reachable via deep link. It had previously been hidden due to the dubious value provided in the current iteration.
This commit is contained in:
Generated
-467
@@ -4950,473 +4950,6 @@ func (q *sqlQuerier) InsertChatFile(ctx context.Context, arg InsertChatFileParam
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getPRInsightsPerModel = `-- name: GetPRInsightsPerModel :many
|
||||
WITH pr_costs AS (
|
||||
SELECT
|
||||
prc.pr_key,
|
||||
COALESCE(SUM(cc.cost_micros), 0) AS cost_micros
|
||||
FROM (
|
||||
SELECT DISTINCT
|
||||
COALESCE(NULLIF(cds.url, ''), c.id::text) AS pr_key,
|
||||
related.id AS chat_id
|
||||
FROM chat_diff_statuses cds
|
||||
JOIN chats c ON c.id = cds.chat_id
|
||||
JOIN chats related
|
||||
ON related.id = c.id
|
||||
OR (related.parent_chat_id = c.id
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM chat_diff_statuses cds2
|
||||
WHERE cds2.chat_id = related.id
|
||||
AND cds2.pull_request_state IS NOT NULL
|
||||
))
|
||||
WHERE cds.pull_request_state IS NOT NULL
|
||||
AND c.created_at >= $1::timestamptz
|
||||
AND c.created_at < $2::timestamptz
|
||||
AND ($3::uuid IS NULL OR c.owner_id = $3::uuid)
|
||||
) prc
|
||||
LEFT JOIN LATERAL (
|
||||
SELECT COALESCE(SUM(cm.total_cost_micros), 0) AS cost_micros
|
||||
FROM chat_messages cm
|
||||
WHERE cm.chat_id = prc.chat_id
|
||||
AND cm.total_cost_micros IS NOT NULL
|
||||
) cc ON TRUE
|
||||
GROUP BY prc.pr_key
|
||||
),
|
||||
deduped AS (
|
||||
SELECT DISTINCT ON (COALESCE(NULLIF(cds.url, ''), c.id::text))
|
||||
COALESCE(NULLIF(cds.url, ''), c.id::text) AS pr_key,
|
||||
cds.pull_request_state,
|
||||
cds.additions,
|
||||
cds.deletions,
|
||||
cmc.id AS model_config_id,
|
||||
cmc.display_name,
|
||||
cmc.model,
|
||||
cmc.provider
|
||||
FROM chat_diff_statuses cds
|
||||
JOIN chats c ON c.id = cds.chat_id
|
||||
LEFT JOIN chat_model_configs cmc ON cmc.id = c.last_model_config_id
|
||||
WHERE cds.pull_request_state IS NOT NULL
|
||||
AND c.created_at >= $1::timestamptz
|
||||
AND c.created_at < $2::timestamptz
|
||||
AND ($3::uuid IS NULL OR c.owner_id = $3::uuid)
|
||||
ORDER BY COALESCE(NULLIF(cds.url, ''), c.id::text), c.created_at DESC, c.id DESC
|
||||
)
|
||||
SELECT
|
||||
d.model_config_id,
|
||||
COALESCE(NULLIF(d.display_name, ''), NULLIF(d.model, ''), 'Unknown')::text AS display_name,
|
||||
COALESCE(d.provider, 'unknown')::text AS provider,
|
||||
COUNT(*)::bigint AS total_prs,
|
||||
COUNT(*) FILTER (WHERE d.pull_request_state = 'merged')::bigint AS merged_prs,
|
||||
COALESCE(SUM(d.additions), 0)::bigint AS total_additions,
|
||||
COALESCE(SUM(d.deletions), 0)::bigint AS total_deletions,
|
||||
COALESCE(SUM(pc.cost_micros), 0)::bigint AS total_cost_micros,
|
||||
COALESCE(SUM(pc.cost_micros) FILTER (WHERE d.pull_request_state = 'merged'), 0)::bigint AS merged_cost_micros
|
||||
FROM deduped d
|
||||
JOIN pr_costs pc ON pc.pr_key = d.pr_key
|
||||
GROUP BY d.model_config_id, d.display_name, d.model, d.provider
|
||||
ORDER BY total_prs DESC
|
||||
`
|
||||
|
||||
type GetPRInsightsPerModelParams struct {
|
||||
StartDate time.Time `db:"start_date" json:"start_date"`
|
||||
EndDate time.Time `db:"end_date" json:"end_date"`
|
||||
OwnerID uuid.NullUUID `db:"owner_id" json:"owner_id"`
|
||||
}
|
||||
|
||||
type GetPRInsightsPerModelRow struct {
|
||||
ModelConfigID uuid.NullUUID `db:"model_config_id" json:"model_config_id"`
|
||||
DisplayName string `db:"display_name" json:"display_name"`
|
||||
Provider string `db:"provider" json:"provider"`
|
||||
TotalPrs int64 `db:"total_prs" json:"total_prs"`
|
||||
MergedPrs int64 `db:"merged_prs" json:"merged_prs"`
|
||||
TotalAdditions int64 `db:"total_additions" json:"total_additions"`
|
||||
TotalDeletions int64 `db:"total_deletions" json:"total_deletions"`
|
||||
TotalCostMicros int64 `db:"total_cost_micros" json:"total_cost_micros"`
|
||||
MergedCostMicros int64 `db:"merged_cost_micros" json:"merged_cost_micros"`
|
||||
}
|
||||
|
||||
// Returns PR metrics grouped by the model used for each chat.
|
||||
// Uses two CTEs: pr_costs sums cost for the PR-linked chat and its
|
||||
// direct children (that lack their own PR), and deduped picks one row
|
||||
// per PR for state/additions/deletions/model (model comes from the
|
||||
// most recent chat).
|
||||
func (q *sqlQuerier) GetPRInsightsPerModel(ctx context.Context, arg GetPRInsightsPerModelParams) ([]GetPRInsightsPerModelRow, error) {
|
||||
rows, err := q.db.QueryContext(ctx, getPRInsightsPerModel, arg.StartDate, arg.EndDate, arg.OwnerID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []GetPRInsightsPerModelRow
|
||||
for rows.Next() {
|
||||
var i GetPRInsightsPerModelRow
|
||||
if err := rows.Scan(
|
||||
&i.ModelConfigID,
|
||||
&i.DisplayName,
|
||||
&i.Provider,
|
||||
&i.TotalPrs,
|
||||
&i.MergedPrs,
|
||||
&i.TotalAdditions,
|
||||
&i.TotalDeletions,
|
||||
&i.TotalCostMicros,
|
||||
&i.MergedCostMicros,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Close(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const getPRInsightsPullRequests = `-- name: GetPRInsightsPullRequests :many
|
||||
WITH pr_costs AS (
|
||||
SELECT
|
||||
prc.pr_key,
|
||||
COALESCE(SUM(cc.cost_micros), 0) AS cost_micros
|
||||
FROM (
|
||||
SELECT DISTINCT
|
||||
COALESCE(NULLIF(cds.url, ''), c.id::text) AS pr_key,
|
||||
related.id AS chat_id
|
||||
FROM chat_diff_statuses cds
|
||||
JOIN chats c ON c.id = cds.chat_id
|
||||
JOIN chats related
|
||||
ON related.id = c.id
|
||||
OR (related.parent_chat_id = c.id
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM chat_diff_statuses cds2
|
||||
WHERE cds2.chat_id = related.id
|
||||
AND cds2.pull_request_state IS NOT NULL
|
||||
))
|
||||
WHERE cds.pull_request_state IS NOT NULL
|
||||
AND c.created_at >= $1::timestamptz
|
||||
AND c.created_at < $2::timestamptz
|
||||
AND ($3::uuid IS NULL OR c.owner_id = $3::uuid)
|
||||
) prc
|
||||
LEFT JOIN LATERAL (
|
||||
SELECT COALESCE(SUM(cm.total_cost_micros), 0) AS cost_micros
|
||||
FROM chat_messages cm
|
||||
WHERE cm.chat_id = prc.chat_id
|
||||
AND cm.total_cost_micros IS NOT NULL
|
||||
) cc ON TRUE
|
||||
GROUP BY prc.pr_key
|
||||
),
|
||||
deduped AS (
|
||||
SELECT DISTINCT ON (COALESCE(NULLIF(cds.url, ''), c.id::text))
|
||||
COALESCE(NULLIF(cds.url, ''), c.id::text) AS pr_key,
|
||||
c.id AS chat_id,
|
||||
cds.pull_request_title AS pr_title,
|
||||
cds.url AS pr_url,
|
||||
cds.pr_number,
|
||||
cds.pull_request_state AS state,
|
||||
cds.pull_request_draft AS draft,
|
||||
cds.additions,
|
||||
cds.deletions,
|
||||
cds.changed_files,
|
||||
cds.commits,
|
||||
cds.approved,
|
||||
cds.changes_requested,
|
||||
cds.reviewer_count,
|
||||
cds.author_login,
|
||||
cds.author_avatar_url,
|
||||
COALESCE(cds.base_branch, '')::text AS base_branch,
|
||||
COALESCE(NULLIF(cmc.display_name, ''), NULLIF(cmc.model, ''), 'Unknown')::text AS model_display_name,
|
||||
c.created_at
|
||||
FROM chat_diff_statuses cds
|
||||
JOIN chats c ON c.id = cds.chat_id
|
||||
LEFT JOIN chat_model_configs cmc ON cmc.id = c.last_model_config_id
|
||||
WHERE cds.pull_request_state IS NOT NULL
|
||||
AND c.created_at >= $1::timestamptz
|
||||
AND c.created_at < $2::timestamptz
|
||||
AND ($3::uuid IS NULL OR c.owner_id = $3::uuid)
|
||||
ORDER BY COALESCE(NULLIF(cds.url, ''), c.id::text), c.created_at DESC, c.id DESC
|
||||
)
|
||||
SELECT chat_id, pr_title, pr_url, pr_number, state, draft, additions, deletions, changed_files, commits, approved, changes_requested, reviewer_count, author_login, author_avatar_url, base_branch, model_display_name, cost_micros, created_at FROM (
|
||||
SELECT
|
||||
d.chat_id,
|
||||
d.pr_title,
|
||||
d.pr_url,
|
||||
d.pr_number,
|
||||
d.state,
|
||||
d.draft,
|
||||
d.additions,
|
||||
d.deletions,
|
||||
d.changed_files,
|
||||
d.commits,
|
||||
d.approved,
|
||||
d.changes_requested,
|
||||
d.reviewer_count,
|
||||
d.author_login,
|
||||
d.author_avatar_url,
|
||||
d.base_branch,
|
||||
d.model_display_name,
|
||||
COALESCE(pc.cost_micros, 0)::bigint AS cost_micros,
|
||||
d.created_at
|
||||
FROM deduped d
|
||||
JOIN pr_costs pc ON pc.pr_key = d.pr_key
|
||||
) sub
|
||||
ORDER BY sub.created_at DESC
|
||||
LIMIT 500
|
||||
`
|
||||
|
||||
type GetPRInsightsPullRequestsParams struct {
|
||||
StartDate time.Time `db:"start_date" json:"start_date"`
|
||||
EndDate time.Time `db:"end_date" json:"end_date"`
|
||||
OwnerID uuid.NullUUID `db:"owner_id" json:"owner_id"`
|
||||
}
|
||||
|
||||
type GetPRInsightsPullRequestsRow struct {
|
||||
ChatID uuid.UUID `db:"chat_id" json:"chat_id"`
|
||||
PrTitle string `db:"pr_title" json:"pr_title"`
|
||||
PrUrl sql.NullString `db:"pr_url" json:"pr_url"`
|
||||
PrNumber sql.NullInt32 `db:"pr_number" json:"pr_number"`
|
||||
State sql.NullString `db:"state" json:"state"`
|
||||
Draft bool `db:"draft" json:"draft"`
|
||||
Additions int32 `db:"additions" json:"additions"`
|
||||
Deletions int32 `db:"deletions" json:"deletions"`
|
||||
ChangedFiles int32 `db:"changed_files" json:"changed_files"`
|
||||
Commits sql.NullInt32 `db:"commits" json:"commits"`
|
||||
Approved sql.NullBool `db:"approved" json:"approved"`
|
||||
ChangesRequested bool `db:"changes_requested" json:"changes_requested"`
|
||||
ReviewerCount sql.NullInt32 `db:"reviewer_count" json:"reviewer_count"`
|
||||
AuthorLogin sql.NullString `db:"author_login" json:"author_login"`
|
||||
AuthorAvatarUrl sql.NullString `db:"author_avatar_url" json:"author_avatar_url"`
|
||||
BaseBranch string `db:"base_branch" json:"base_branch"`
|
||||
ModelDisplayName string `db:"model_display_name" json:"model_display_name"`
|
||||
CostMicros int64 `db:"cost_micros" json:"cost_micros"`
|
||||
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
||||
}
|
||||
|
||||
// Returns all individual PR rows with cost for the selected time range.
|
||||
// Uses two CTEs: pr_costs sums cost for the PR-linked chat and its
|
||||
// direct children (that lack their own PR), and deduped picks one row
|
||||
// per PR for metadata. A safety-cap LIMIT guards against unexpectedly
|
||||
// large result sets from direct API callers.
|
||||
func (q *sqlQuerier) GetPRInsightsPullRequests(ctx context.Context, arg GetPRInsightsPullRequestsParams) ([]GetPRInsightsPullRequestsRow, error) {
|
||||
rows, err := q.db.QueryContext(ctx, getPRInsightsPullRequests, arg.StartDate, arg.EndDate, arg.OwnerID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []GetPRInsightsPullRequestsRow
|
||||
for rows.Next() {
|
||||
var i GetPRInsightsPullRequestsRow
|
||||
if err := rows.Scan(
|
||||
&i.ChatID,
|
||||
&i.PrTitle,
|
||||
&i.PrUrl,
|
||||
&i.PrNumber,
|
||||
&i.State,
|
||||
&i.Draft,
|
||||
&i.Additions,
|
||||
&i.Deletions,
|
||||
&i.ChangedFiles,
|
||||
&i.Commits,
|
||||
&i.Approved,
|
||||
&i.ChangesRequested,
|
||||
&i.ReviewerCount,
|
||||
&i.AuthorLogin,
|
||||
&i.AuthorAvatarUrl,
|
||||
&i.BaseBranch,
|
||||
&i.ModelDisplayName,
|
||||
&i.CostMicros,
|
||||
&i.CreatedAt,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Close(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const getPRInsightsSummary = `-- name: GetPRInsightsSummary :one
|
||||
|
||||
WITH pr_costs AS (
|
||||
SELECT
|
||||
prc.pr_key,
|
||||
COALESCE(SUM(cc.cost_micros), 0) AS cost_micros
|
||||
FROM (
|
||||
-- For each PR, include the chat that references it plus any
|
||||
-- direct children (subagents) that do not have their own PR.
|
||||
SELECT DISTINCT
|
||||
COALESCE(NULLIF(cds.url, ''), c.id::text) AS pr_key,
|
||||
related.id AS chat_id
|
||||
FROM chat_diff_statuses cds
|
||||
JOIN chats c ON c.id = cds.chat_id
|
||||
JOIN chats related
|
||||
ON related.id = c.id
|
||||
OR (related.parent_chat_id = c.id
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM chat_diff_statuses cds2
|
||||
WHERE cds2.chat_id = related.id
|
||||
AND cds2.pull_request_state IS NOT NULL
|
||||
))
|
||||
WHERE cds.pull_request_state IS NOT NULL
|
||||
AND c.created_at >= $1::timestamptz
|
||||
AND c.created_at < $2::timestamptz
|
||||
AND ($3::uuid IS NULL OR c.owner_id = $3::uuid)
|
||||
) prc
|
||||
LEFT JOIN LATERAL (
|
||||
SELECT COALESCE(SUM(cm.total_cost_micros), 0) AS cost_micros
|
||||
FROM chat_messages cm
|
||||
WHERE cm.chat_id = prc.chat_id
|
||||
AND cm.total_cost_micros IS NOT NULL
|
||||
) cc ON TRUE
|
||||
GROUP BY prc.pr_key
|
||||
),
|
||||
deduped AS (
|
||||
SELECT DISTINCT ON (COALESCE(NULLIF(cds.url, ''), c.id::text))
|
||||
COALESCE(NULLIF(cds.url, ''), c.id::text) AS pr_key,
|
||||
cds.pull_request_state,
|
||||
cds.additions,
|
||||
cds.deletions
|
||||
FROM chat_diff_statuses cds
|
||||
JOIN chats c ON c.id = cds.chat_id
|
||||
WHERE cds.pull_request_state IS NOT NULL
|
||||
AND c.created_at >= $1::timestamptz
|
||||
AND c.created_at < $2::timestamptz
|
||||
AND ($3::uuid IS NULL OR c.owner_id = $3::uuid)
|
||||
ORDER BY COALESCE(NULLIF(cds.url, ''), c.id::text), c.created_at DESC, c.id DESC
|
||||
)
|
||||
SELECT
|
||||
COUNT(*)::bigint AS total_prs_created,
|
||||
COUNT(*) FILTER (WHERE d.pull_request_state = 'merged')::bigint AS total_prs_merged,
|
||||
COUNT(*) FILTER (WHERE d.pull_request_state = 'closed')::bigint AS total_prs_closed,
|
||||
COALESCE(SUM(d.additions), 0)::bigint AS total_additions,
|
||||
COALESCE(SUM(d.deletions), 0)::bigint AS total_deletions,
|
||||
COALESCE(SUM(pc.cost_micros), 0)::bigint AS total_cost_micros,
|
||||
COALESCE(SUM(pc.cost_micros) FILTER (WHERE d.pull_request_state = 'merged'), 0)::bigint AS merged_cost_micros
|
||||
FROM deduped d
|
||||
JOIN pr_costs pc ON pc.pr_key = d.pr_key
|
||||
`
|
||||
|
||||
type GetPRInsightsSummaryParams struct {
|
||||
StartDate time.Time `db:"start_date" json:"start_date"`
|
||||
EndDate time.Time `db:"end_date" json:"end_date"`
|
||||
OwnerID uuid.NullUUID `db:"owner_id" json:"owner_id"`
|
||||
}
|
||||
|
||||
type GetPRInsightsSummaryRow struct {
|
||||
TotalPrsCreated int64 `db:"total_prs_created" json:"total_prs_created"`
|
||||
TotalPrsMerged int64 `db:"total_prs_merged" json:"total_prs_merged"`
|
||||
TotalPrsClosed int64 `db:"total_prs_closed" json:"total_prs_closed"`
|
||||
TotalAdditions int64 `db:"total_additions" json:"total_additions"`
|
||||
TotalDeletions int64 `db:"total_deletions" json:"total_deletions"`
|
||||
TotalCostMicros int64 `db:"total_cost_micros" json:"total_cost_micros"`
|
||||
MergedCostMicros int64 `db:"merged_cost_micros" json:"merged_cost_micros"`
|
||||
}
|
||||
|
||||
// PR Insights queries for the /agents analytics dashboard.
|
||||
// These aggregate data from chat_diff_statuses (PR metadata) joined
|
||||
// with chats and chat_messages (cost) to power the PR Insights view.
|
||||
//
|
||||
// Cost is computed per PR by summing the PR-linked chat's own cost plus
|
||||
// the costs of any direct children (subagents) it spawned that do NOT
|
||||
// have their own PR association. If a child chat has its own
|
||||
// chat_diff_statuses entry (with a non-NULL pull_request_state), its
|
||||
// cost is attributed to that child's PR instead — preventing
|
||||
// double-counting when sibling chats create different PRs.
|
||||
// Subagent trees are at most 2 levels deep (enforced by the
|
||||
// application layer). PR metadata (state, additions, deletions)
|
||||
// comes from the most recent chat via DISTINCT ON so that each PR
|
||||
// is counted exactly once.
|
||||
// Returns aggregate PR metrics for the given date range.
|
||||
// The handler calls this twice (current + previous period) for trends.
|
||||
// Uses two CTEs: pr_costs sums cost for the PR-linked chat and its
|
||||
// direct children (that lack their own PR), and deduped picks one row
|
||||
// per PR for state/additions/deletions.
|
||||
func (q *sqlQuerier) GetPRInsightsSummary(ctx context.Context, arg GetPRInsightsSummaryParams) (GetPRInsightsSummaryRow, error) {
|
||||
row := q.db.QueryRowContext(ctx, getPRInsightsSummary, arg.StartDate, arg.EndDate, arg.OwnerID)
|
||||
var i GetPRInsightsSummaryRow
|
||||
err := row.Scan(
|
||||
&i.TotalPrsCreated,
|
||||
&i.TotalPrsMerged,
|
||||
&i.TotalPrsClosed,
|
||||
&i.TotalAdditions,
|
||||
&i.TotalDeletions,
|
||||
&i.TotalCostMicros,
|
||||
&i.MergedCostMicros,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getPRInsightsTimeSeries = `-- name: GetPRInsightsTimeSeries :many
|
||||
WITH deduped AS (
|
||||
SELECT DISTINCT ON (COALESCE(NULLIF(cds.url, ''), c.id::text))
|
||||
cds.pull_request_state,
|
||||
c.created_at
|
||||
FROM chat_diff_statuses cds
|
||||
JOIN chats c ON c.id = cds.chat_id
|
||||
WHERE cds.pull_request_state IS NOT NULL
|
||||
AND c.created_at >= $1::timestamptz
|
||||
AND c.created_at < $2::timestamptz
|
||||
AND ($3::uuid IS NULL OR c.owner_id = $3::uuid)
|
||||
ORDER BY COALESCE(NULLIF(cds.url, ''), c.id::text), c.created_at DESC, c.id DESC
|
||||
)
|
||||
SELECT
|
||||
date_trunc('day', created_at)::timestamptz AS date,
|
||||
COUNT(*)::bigint AS prs_created,
|
||||
COUNT(*) FILTER (WHERE pull_request_state = 'merged')::bigint AS prs_merged,
|
||||
COUNT(*) FILTER (WHERE pull_request_state = 'closed')::bigint AS prs_closed
|
||||
FROM deduped
|
||||
GROUP BY date_trunc('day', created_at)
|
||||
ORDER BY date_trunc('day', created_at)
|
||||
`
|
||||
|
||||
type GetPRInsightsTimeSeriesParams struct {
|
||||
StartDate time.Time `db:"start_date" json:"start_date"`
|
||||
EndDate time.Time `db:"end_date" json:"end_date"`
|
||||
OwnerID uuid.NullUUID `db:"owner_id" json:"owner_id"`
|
||||
}
|
||||
|
||||
type GetPRInsightsTimeSeriesRow struct {
|
||||
Date time.Time `db:"date" json:"date"`
|
||||
PrsCreated int64 `db:"prs_created" json:"prs_created"`
|
||||
PrsMerged int64 `db:"prs_merged" json:"prs_merged"`
|
||||
PrsClosed int64 `db:"prs_closed" json:"prs_closed"`
|
||||
}
|
||||
|
||||
// Returns daily PR counts grouped by state for the chart.
|
||||
// Uses a CTE to deduplicate by PR URL so that multiple chats referencing
|
||||
// the same pull request are only counted once (keeping the most recent chat).
|
||||
func (q *sqlQuerier) GetPRInsightsTimeSeries(ctx context.Context, arg GetPRInsightsTimeSeriesParams) ([]GetPRInsightsTimeSeriesRow, error) {
|
||||
rows, err := q.db.QueryContext(ctx, getPRInsightsTimeSeries, arg.StartDate, arg.EndDate, arg.OwnerID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []GetPRInsightsTimeSeriesRow
|
||||
for rows.Next() {
|
||||
var i GetPRInsightsTimeSeriesRow
|
||||
if err := rows.Scan(
|
||||
&i.Date,
|
||||
&i.PrsCreated,
|
||||
&i.PrsMerged,
|
||||
&i.PrsClosed,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Close(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const backfillChatModelConfigProvider = `-- name: BackfillChatModelConfigProvider :execresult
|
||||
UPDATE
|
||||
chat_model_configs
|
||||
|
||||
Reference in New Issue
Block a user