You've already forked agentic-coding-workflow
154 lines
3.7 KiB
Go
154 lines
3.7 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.31.1
|
|
// source: summaries.sql
|
|
|
|
package docssqlc
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
const getSummary = `-- name: GetSummary :one
|
|
SELECT id, workspace_id, worktree_id, branch, commit_sha, kind,
|
|
title, body_md, model, status, error, created_at
|
|
FROM commit_summaries
|
|
WHERE workspace_id = $1 AND commit_sha = $2 AND kind = $3
|
|
`
|
|
|
|
type GetSummaryParams struct {
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
CommitSha string `json:"commit_sha"`
|
|
Kind string `json:"kind"`
|
|
}
|
|
|
|
func (q *Queries) GetSummary(ctx context.Context, arg GetSummaryParams) (CommitSummary, error) {
|
|
row := q.db.QueryRow(ctx, getSummary, arg.WorkspaceID, arg.CommitSha, arg.Kind)
|
|
var i CommitSummary
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.WorkspaceID,
|
|
&i.WorktreeID,
|
|
&i.Branch,
|
|
&i.CommitSha,
|
|
&i.Kind,
|
|
&i.Title,
|
|
&i.BodyMd,
|
|
&i.Model,
|
|
&i.Status,
|
|
&i.Error,
|
|
&i.CreatedAt,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const insertPendingSummary = `-- name: InsertPendingSummary :one
|
|
INSERT INTO commit_summaries (
|
|
id, workspace_id, worktree_id, branch, commit_sha, kind, body_md, status
|
|
) VALUES ($1, $2, $3, $4, $5, $6, '', 'pending')
|
|
ON CONFLICT (workspace_id, commit_sha, kind) DO NOTHING
|
|
RETURNING id, workspace_id, worktree_id, branch, commit_sha, kind,
|
|
title, body_md, model, status, error, created_at
|
|
`
|
|
|
|
type InsertPendingSummaryParams struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
WorktreeID pgtype.UUID `json:"worktree_id"`
|
|
Branch string `json:"branch"`
|
|
CommitSha string `json:"commit_sha"`
|
|
Kind string `json:"kind"`
|
|
}
|
|
|
|
func (q *Queries) InsertPendingSummary(ctx context.Context, arg InsertPendingSummaryParams) (CommitSummary, error) {
|
|
row := q.db.QueryRow(ctx, insertPendingSummary,
|
|
arg.ID,
|
|
arg.WorkspaceID,
|
|
arg.WorktreeID,
|
|
arg.Branch,
|
|
arg.CommitSha,
|
|
arg.Kind,
|
|
)
|
|
var i CommitSummary
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.WorkspaceID,
|
|
&i.WorktreeID,
|
|
&i.Branch,
|
|
&i.CommitSha,
|
|
&i.Kind,
|
|
&i.Title,
|
|
&i.BodyMd,
|
|
&i.Model,
|
|
&i.Status,
|
|
&i.Error,
|
|
&i.CreatedAt,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const upsertSummary = `-- name: UpsertSummary :one
|
|
INSERT INTO commit_summaries (
|
|
id, workspace_id, worktree_id, branch, commit_sha, kind,
|
|
title, body_md, model, status, error
|
|
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)
|
|
ON CONFLICT (workspace_id, commit_sha, kind) DO UPDATE
|
|
SET title = EXCLUDED.title,
|
|
body_md = EXCLUDED.body_md,
|
|
model = EXCLUDED.model,
|
|
status = EXCLUDED.status,
|
|
error = EXCLUDED.error,
|
|
branch = EXCLUDED.branch,
|
|
worktree_id = EXCLUDED.worktree_id
|
|
RETURNING id, workspace_id, worktree_id, branch, commit_sha, kind,
|
|
title, body_md, model, status, error, created_at
|
|
`
|
|
|
|
type UpsertSummaryParams struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
WorktreeID pgtype.UUID `json:"worktree_id"`
|
|
Branch string `json:"branch"`
|
|
CommitSha string `json:"commit_sha"`
|
|
Kind string `json:"kind"`
|
|
Title *string `json:"title"`
|
|
BodyMd string `json:"body_md"`
|
|
Model *string `json:"model"`
|
|
Status string `json:"status"`
|
|
Error *string `json:"error"`
|
|
}
|
|
|
|
func (q *Queries) UpsertSummary(ctx context.Context, arg UpsertSummaryParams) (CommitSummary, error) {
|
|
row := q.db.QueryRow(ctx, upsertSummary,
|
|
arg.ID,
|
|
arg.WorkspaceID,
|
|
arg.WorktreeID,
|
|
arg.Branch,
|
|
arg.CommitSha,
|
|
arg.Kind,
|
|
arg.Title,
|
|
arg.BodyMd,
|
|
arg.Model,
|
|
arg.Status,
|
|
arg.Error,
|
|
)
|
|
var i CommitSummary
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.WorkspaceID,
|
|
&i.WorktreeID,
|
|
&i.Branch,
|
|
&i.CommitSha,
|
|
&i.Kind,
|
|
&i.Title,
|
|
&i.BodyMd,
|
|
&i.Model,
|
|
&i.Status,
|
|
&i.Error,
|
|
&i.CreatedAt,
|
|
)
|
|
return i, err
|
|
}
|