You've already forked agentic-coding-workflow
原型阶段
This commit is contained in:
@@ -276,6 +276,16 @@ type Requirement struct {
|
||||
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
||||
}
|
||||
|
||||
type RequirementPrototype struct {
|
||||
ID pgtype.UUID `json:"id"`
|
||||
RequirementID pgtype.UUID `json:"requirement_id"`
|
||||
Version int32 `json:"version"`
|
||||
Content string `json:"content"`
|
||||
Note string `json:"note"`
|
||||
CreatedBy pgtype.UUID `json:"created_by"`
|
||||
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
||||
}
|
||||
|
||||
type User struct {
|
||||
ID pgtype.UUID `json:"id"`
|
||||
Email string `json:"email"`
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.31.1
|
||||
// source: prototypes.sql
|
||||
|
||||
package projectsqlc
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
const createRequirementPrototype = `-- name: CreateRequirementPrototype :one
|
||||
INSERT INTO requirement_prototypes (id, requirement_id, version, content, note, created_by)
|
||||
VALUES ($1, $2, $3, $4, $5, $6)
|
||||
RETURNING id, requirement_id, version, content, note, created_by, created_at
|
||||
`
|
||||
|
||||
type CreateRequirementPrototypeParams struct {
|
||||
ID pgtype.UUID `json:"id"`
|
||||
RequirementID pgtype.UUID `json:"requirement_id"`
|
||||
Version int32 `json:"version"`
|
||||
Content string `json:"content"`
|
||||
Note string `json:"note"`
|
||||
CreatedBy pgtype.UUID `json:"created_by"`
|
||||
}
|
||||
|
||||
func (q *Queries) CreateRequirementPrototype(ctx context.Context, arg CreateRequirementPrototypeParams) (RequirementPrototype, error) {
|
||||
row := q.db.QueryRow(ctx, createRequirementPrototype,
|
||||
arg.ID,
|
||||
arg.RequirementID,
|
||||
arg.Version,
|
||||
arg.Content,
|
||||
arg.Note,
|
||||
arg.CreatedBy,
|
||||
)
|
||||
var i RequirementPrototype
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.RequirementID,
|
||||
&i.Version,
|
||||
&i.Content,
|
||||
&i.Note,
|
||||
&i.CreatedBy,
|
||||
&i.CreatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getMaxRequirementPrototypeVersion = `-- name: GetMaxRequirementPrototypeVersion :one
|
||||
SELECT COALESCE(MAX(version), 0)::int FROM requirement_prototypes
|
||||
WHERE requirement_id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetMaxRequirementPrototypeVersion(ctx context.Context, requirementID pgtype.UUID) (int32, error) {
|
||||
row := q.db.QueryRow(ctx, getMaxRequirementPrototypeVersion, requirementID)
|
||||
var column_1 int32
|
||||
err := row.Scan(&column_1)
|
||||
return column_1, err
|
||||
}
|
||||
|
||||
const getRequirementPrototypeByVersion = `-- name: GetRequirementPrototypeByVersion :one
|
||||
SELECT id, requirement_id, version, content, note, created_by, created_at
|
||||
FROM requirement_prototypes
|
||||
WHERE requirement_id = $1 AND version = $2
|
||||
`
|
||||
|
||||
type GetRequirementPrototypeByVersionParams struct {
|
||||
RequirementID pgtype.UUID `json:"requirement_id"`
|
||||
Version int32 `json:"version"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetRequirementPrototypeByVersion(ctx context.Context, arg GetRequirementPrototypeByVersionParams) (RequirementPrototype, error) {
|
||||
row := q.db.QueryRow(ctx, getRequirementPrototypeByVersion, arg.RequirementID, arg.Version)
|
||||
var i RequirementPrototype
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.RequirementID,
|
||||
&i.Version,
|
||||
&i.Content,
|
||||
&i.Note,
|
||||
&i.CreatedBy,
|
||||
&i.CreatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const listRequirementPrototypesByRequirement = `-- name: ListRequirementPrototypesByRequirement :many
|
||||
SELECT id, requirement_id, version, content, note, created_by, created_at
|
||||
FROM requirement_prototypes
|
||||
WHERE requirement_id = $1
|
||||
ORDER BY version ASC
|
||||
`
|
||||
|
||||
func (q *Queries) ListRequirementPrototypesByRequirement(ctx context.Context, requirementID pgtype.UUID) ([]RequirementPrototype, error) {
|
||||
rows, err := q.db.Query(ctx, listRequirementPrototypesByRequirement, requirementID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []RequirementPrototype
|
||||
for rows.Next() {
|
||||
var i RequirementPrototype
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.RequirementID,
|
||||
&i.Version,
|
||||
&i.Content,
|
||||
&i.Note,
|
||||
&i.CreatedBy,
|
||||
&i.CreatedAt,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
Reference in New Issue
Block a user