Files
agentic-coding-workflow/internal/acp/sqlc/agent_kinds.sql.go
T

264 lines
6.1 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
// source: agent_kinds.sql
package acpsqlc
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
)
const countAgentKindUsage = `-- name: CountAgentKindUsage :one
SELECT COUNT(*) FROM acp_sessions WHERE agent_kind_id = $1
`
func (q *Queries) CountAgentKindUsage(ctx context.Context, agentKindID pgtype.UUID) (int64, error) {
row := q.db.QueryRow(ctx, countAgentKindUsage, agentKindID)
var count int64
err := row.Scan(&count)
return count, err
}
const createAgentKind = `-- name: CreateAgentKind :one
INSERT INTO acp_agent_kinds (
id, name, display_name, description, binary_path, args, encrypted_env, enabled, created_by
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
RETURNING id, name, display_name, description, binary_path, args, encrypted_env,
enabled, created_by, created_at, updated_at
`
type CreateAgentKindParams struct {
ID pgtype.UUID `json:"id"`
Name string `json:"name"`
DisplayName string `json:"display_name"`
Description string `json:"description"`
BinaryPath string `json:"binary_path"`
Args []string `json:"args"`
EncryptedEnv []byte `json:"encrypted_env"`
Enabled bool `json:"enabled"`
CreatedBy pgtype.UUID `json:"created_by"`
}
func (q *Queries) CreateAgentKind(ctx context.Context, arg CreateAgentKindParams) (AcpAgentKind, error) {
row := q.db.QueryRow(ctx, createAgentKind,
arg.ID,
arg.Name,
arg.DisplayName,
arg.Description,
arg.BinaryPath,
arg.Args,
arg.EncryptedEnv,
arg.Enabled,
arg.CreatedBy,
)
var i AcpAgentKind
err := row.Scan(
&i.ID,
&i.Name,
&i.DisplayName,
&i.Description,
&i.BinaryPath,
&i.Args,
&i.EncryptedEnv,
&i.Enabled,
&i.CreatedBy,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}
const deleteAgentKind = `-- name: DeleteAgentKind :exec
DELETE FROM acp_agent_kinds WHERE id = $1
`
func (q *Queries) DeleteAgentKind(ctx context.Context, id pgtype.UUID) error {
_, err := q.db.Exec(ctx, deleteAgentKind, id)
return err
}
const getAgentKindByID = `-- name: GetAgentKindByID :one
SELECT id, name, display_name, description, binary_path, args, encrypted_env,
enabled, created_by, created_at, updated_at
FROM acp_agent_kinds
WHERE id = $1
`
func (q *Queries) GetAgentKindByID(ctx context.Context, id pgtype.UUID) (AcpAgentKind, error) {
row := q.db.QueryRow(ctx, getAgentKindByID, id)
var i AcpAgentKind
err := row.Scan(
&i.ID,
&i.Name,
&i.DisplayName,
&i.Description,
&i.BinaryPath,
&i.Args,
&i.EncryptedEnv,
&i.Enabled,
&i.CreatedBy,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}
const getAgentKindByName = `-- name: GetAgentKindByName :one
SELECT id, name, display_name, description, binary_path, args, encrypted_env,
enabled, created_by, created_at, updated_at
FROM acp_agent_kinds
WHERE name = $1
`
func (q *Queries) GetAgentKindByName(ctx context.Context, name string) (AcpAgentKind, error) {
row := q.db.QueryRow(ctx, getAgentKindByName, name)
var i AcpAgentKind
err := row.Scan(
&i.ID,
&i.Name,
&i.DisplayName,
&i.Description,
&i.BinaryPath,
&i.Args,
&i.EncryptedEnv,
&i.Enabled,
&i.CreatedBy,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}
const listAgentKinds = `-- name: ListAgentKinds :many
SELECT id, name, display_name, description, binary_path, args, encrypted_env,
enabled, created_by, created_at, updated_at
FROM acp_agent_kinds
ORDER BY created_at DESC
`
func (q *Queries) ListAgentKinds(ctx context.Context) ([]AcpAgentKind, error) {
rows, err := q.db.Query(ctx, listAgentKinds)
if err != nil {
return nil, err
}
defer rows.Close()
var items []AcpAgentKind
for rows.Next() {
var i AcpAgentKind
if err := rows.Scan(
&i.ID,
&i.Name,
&i.DisplayName,
&i.Description,
&i.BinaryPath,
&i.Args,
&i.EncryptedEnv,
&i.Enabled,
&i.CreatedBy,
&i.CreatedAt,
&i.UpdatedAt,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const listEnabledAgentKinds = `-- name: ListEnabledAgentKinds :many
SELECT id, name, display_name, description, binary_path, args, encrypted_env,
enabled, created_by, created_at, updated_at
FROM acp_agent_kinds
WHERE enabled = TRUE
ORDER BY name ASC
`
func (q *Queries) ListEnabledAgentKinds(ctx context.Context) ([]AcpAgentKind, error) {
rows, err := q.db.Query(ctx, listEnabledAgentKinds)
if err != nil {
return nil, err
}
defer rows.Close()
var items []AcpAgentKind
for rows.Next() {
var i AcpAgentKind
if err := rows.Scan(
&i.ID,
&i.Name,
&i.DisplayName,
&i.Description,
&i.BinaryPath,
&i.Args,
&i.EncryptedEnv,
&i.Enabled,
&i.CreatedBy,
&i.CreatedAt,
&i.UpdatedAt,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const updateAgentKind = `-- name: UpdateAgentKind :one
UPDATE acp_agent_kinds
SET display_name = $2,
description = $3,
binary_path = $4,
args = $5,
encrypted_env = $6,
enabled = $7,
updated_at = now()
WHERE id = $1
RETURNING id, name, display_name, description, binary_path, args, encrypted_env,
enabled, created_by, created_at, updated_at
`
type UpdateAgentKindParams struct {
ID pgtype.UUID `json:"id"`
DisplayName string `json:"display_name"`
Description string `json:"description"`
BinaryPath string `json:"binary_path"`
Args []string `json:"args"`
EncryptedEnv []byte `json:"encrypted_env"`
Enabled bool `json:"enabled"`
}
func (q *Queries) UpdateAgentKind(ctx context.Context, arg UpdateAgentKindParams) (AcpAgentKind, error) {
row := q.db.QueryRow(ctx, updateAgentKind,
arg.ID,
arg.DisplayName,
arg.Description,
arg.BinaryPath,
arg.Args,
arg.EncryptedEnv,
arg.Enabled,
)
var i AcpAgentKind
err := row.Scan(
&i.ID,
&i.Name,
&i.DisplayName,
&i.Description,
&i.BinaryPath,
&i.Args,
&i.EncryptedEnv,
&i.Enabled,
&i.CreatedBy,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}