Loggest thy stuff
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

  1. // Code generated by sqlc. DO NOT EDIT.
  2. // versions:
  3. // sqlc v1.13.0
  4. // source: project.sql
  5. package mysqlcore
  6. import (
  7. "context"
  8. )
  9. const getProject = `-- name: GetProject :one
  10. SELECT id, scope_id, author_id, name, status, description, created_time FROM project WHERE id = ?
  11. `
  12. func (q *Queries) GetProject(ctx context.Context, id int) (Project, error) {
  13. row := q.db.QueryRowContext(ctx, getProject, id)
  14. var i Project
  15. err := row.Scan(
  16. &i.ID,
  17. &i.ScopeID,
  18. &i.AuthorID,
  19. &i.Name,
  20. &i.Status,
  21. &i.Description,
  22. &i.CreatedTime,
  23. )
  24. return i, err
  25. }
  26. const listProjectEntries = `-- name: ListProjectEntries :many
  27. SELECT id, name, status FROM project
  28. WHERE scope_id = ?
  29. ORDER BY status, created_time
  30. `
  31. type ListProjectEntriesRow struct {
  32. ID int
  33. Name string
  34. Status int
  35. }
  36. func (q *Queries) ListProjectEntries(ctx context.Context, scopeID int) ([]ListProjectEntriesRow, error) {
  37. rows, err := q.db.QueryContext(ctx, listProjectEntries, scopeID)
  38. if err != nil {
  39. return nil, err
  40. }
  41. defer rows.Close()
  42. items := []ListProjectEntriesRow{}
  43. for rows.Next() {
  44. var i ListProjectEntriesRow
  45. if err := rows.Scan(&i.ID, &i.Name, &i.Status); err != nil {
  46. return nil, err
  47. }
  48. items = append(items, i)
  49. }
  50. if err := rows.Close(); err != nil {
  51. return nil, err
  52. }
  53. if err := rows.Err(); err != nil {
  54. return nil, err
  55. }
  56. return items, nil
  57. }
  58. const listProjectRequirementsByProjectID = `-- name: ListProjectRequirementsByProjectID :many
  59. SELECT id, scope_id, project_id, name, status, description FROM project_requirement WHERE project_id = ?
  60. `
  61. func (q *Queries) ListProjectRequirementsByProjectID(ctx context.Context, projectID int) ([]ProjectRequirement, error) {
  62. rows, err := q.db.QueryContext(ctx, listProjectRequirementsByProjectID, projectID)
  63. if err != nil {
  64. return nil, err
  65. }
  66. defer rows.Close()
  67. items := []ProjectRequirement{}
  68. for rows.Next() {
  69. var i ProjectRequirement
  70. if err := rows.Scan(
  71. &i.ID,
  72. &i.ScopeID,
  73. &i.ProjectID,
  74. &i.Name,
  75. &i.Status,
  76. &i.Description,
  77. ); err != nil {
  78. return nil, err
  79. }
  80. items = append(items, i)
  81. }
  82. if err := rows.Close(); err != nil {
  83. return nil, err
  84. }
  85. if err := rows.Err(); err != nil {
  86. return nil, err
  87. }
  88. return items, nil
  89. }