You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
2.2 KiB
98 lines
2.2 KiB
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.13.0
|
|
// source: project.sql
|
|
|
|
package mysqlcore
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
const getProject = `-- name: GetProject :one
|
|
SELECT id, scope_id, author_id, name, status, description, created_time FROM project WHERE id = ?
|
|
`
|
|
|
|
func (q *Queries) GetProject(ctx context.Context, id int) (Project, error) {
|
|
row := q.db.QueryRowContext(ctx, getProject, id)
|
|
var i Project
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.ScopeID,
|
|
&i.AuthorID,
|
|
&i.Name,
|
|
&i.Status,
|
|
&i.Description,
|
|
&i.CreatedTime,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const listProjectEntries = `-- name: ListProjectEntries :many
|
|
SELECT id, name, status FROM project
|
|
WHERE scope_id = ?
|
|
ORDER BY status, created_time
|
|
`
|
|
|
|
type ListProjectEntriesRow struct {
|
|
ID int
|
|
Name string
|
|
Status int
|
|
}
|
|
|
|
func (q *Queries) ListProjectEntries(ctx context.Context, scopeID int) ([]ListProjectEntriesRow, error) {
|
|
rows, err := q.db.QueryContext(ctx, listProjectEntries, scopeID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
items := []ListProjectEntriesRow{}
|
|
for rows.Next() {
|
|
var i ListProjectEntriesRow
|
|
if err := rows.Scan(&i.ID, &i.Name, &i.Status); 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 listProjectRequirementsByProjectID = `-- name: ListProjectRequirementsByProjectID :many
|
|
SELECT id, scope_id, project_id, name, status, description FROM project_requirement WHERE project_id = ?
|
|
`
|
|
|
|
func (q *Queries) ListProjectRequirementsByProjectID(ctx context.Context, projectID int) ([]ProjectRequirement, error) {
|
|
rows, err := q.db.QueryContext(ctx, listProjectRequirementsByProjectID, projectID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
items := []ProjectRequirement{}
|
|
for rows.Next() {
|
|
var i ProjectRequirement
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.ScopeID,
|
|
&i.ProjectID,
|
|
&i.Name,
|
|
&i.Status,
|
|
&i.Description,
|
|
); 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
|
|
}
|