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.
327 lines
7.3 KiB
327 lines
7.3 KiB
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.13.0
|
|
// source: sprint.sql
|
|
|
|
package mysqlcore
|
|
|
|
import (
|
|
"context"
|
|
"database/sql"
|
|
"time"
|
|
)
|
|
|
|
const deleteAllScopeSprints = `-- name: DeleteAllScopeSprints :exec
|
|
DELETE
|
|
FROM sprint
|
|
WHERE scope_id = ?
|
|
`
|
|
|
|
func (q *Queries) DeleteAllScopeSprints(ctx context.Context, scopeID int) error {
|
|
_, err := q.exec(ctx, q.deleteAllScopeSprintsStmt, deleteAllScopeSprints, scopeID)
|
|
return err
|
|
}
|
|
|
|
const deleteAllSprintParts = `-- name: DeleteAllSprintParts :exec
|
|
DELETE
|
|
FROM sprint_part
|
|
WHERE sprint_id = ?
|
|
`
|
|
|
|
func (q *Queries) DeleteAllSprintParts(ctx context.Context, sprintID int) error {
|
|
_, err := q.exec(ctx, q.deleteAllSprintPartsStmt, deleteAllSprintParts, sprintID)
|
|
return err
|
|
}
|
|
|
|
const deleteSprint = `-- name: DeleteSprint :exec
|
|
DELETE
|
|
FROM sprint
|
|
WHERE id = ?
|
|
`
|
|
|
|
func (q *Queries) DeleteSprint(ctx context.Context, id int) error {
|
|
_, err := q.exec(ctx, q.deleteSprintStmt, deleteSprint, id)
|
|
return err
|
|
}
|
|
|
|
const deleteSprintPart = `-- name: DeleteSprintPart :exec
|
|
DELETE
|
|
FROM sprint_part
|
|
WHERE sprint_id = ?
|
|
AND object_id = ?
|
|
`
|
|
|
|
type DeleteSprintPartParams struct {
|
|
SprintID int
|
|
ObjectID int
|
|
}
|
|
|
|
func (q *Queries) DeleteSprintPart(ctx context.Context, arg DeleteSprintPartParams) error {
|
|
_, err := q.exec(ctx, q.deleteSprintPartStmt, deleteSprintPart, arg.SprintID, arg.ObjectID)
|
|
return err
|
|
}
|
|
|
|
const getSprint = `-- name: GetSprint :one
|
|
SELECT id, scope_id, name, description, from_time, to_time, is_timed, is_coarse, is_unweighted, kind, aggregate_name, aggregate_required, tags_csv
|
|
FROM sprint
|
|
WHERE id = ?
|
|
AND scope_id = ?
|
|
`
|
|
|
|
type GetSprintParams struct {
|
|
ID int
|
|
ScopeID int
|
|
}
|
|
|
|
func (q *Queries) GetSprint(ctx context.Context, arg GetSprintParams) (Sprint, error) {
|
|
row := q.queryRow(ctx, q.getSprintStmt, getSprint, arg.ID, arg.ScopeID)
|
|
var i Sprint
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.ScopeID,
|
|
&i.Name,
|
|
&i.Description,
|
|
&i.FromTime,
|
|
&i.ToTime,
|
|
&i.IsTimed,
|
|
&i.IsCoarse,
|
|
&i.IsUnweighted,
|
|
&i.Kind,
|
|
&i.AggregateName,
|
|
&i.AggregateRequired,
|
|
&i.TagsCsv,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const insertSprint = `-- name: InsertSprint :execresult
|
|
INSERT INTO sprint (scope_id, name, description, kind, from_time, to_time,
|
|
is_timed, is_coarse, aggregate_name, aggregate_required,
|
|
is_unweighted, tags_csv)
|
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
`
|
|
|
|
type InsertSprintParams struct {
|
|
ScopeID int
|
|
Name string
|
|
Description string
|
|
Kind int
|
|
FromTime time.Time
|
|
ToTime time.Time
|
|
IsTimed bool
|
|
IsCoarse bool
|
|
AggregateName string
|
|
AggregateRequired int
|
|
IsUnweighted bool
|
|
TagsCsv sql.NullString
|
|
}
|
|
|
|
func (q *Queries) InsertSprint(ctx context.Context, arg InsertSprintParams) (sql.Result, error) {
|
|
return q.exec(ctx, q.insertSprintStmt, insertSprint,
|
|
arg.ScopeID,
|
|
arg.Name,
|
|
arg.Description,
|
|
arg.Kind,
|
|
arg.FromTime,
|
|
arg.ToTime,
|
|
arg.IsTimed,
|
|
arg.IsCoarse,
|
|
arg.AggregateName,
|
|
arg.AggregateRequired,
|
|
arg.IsUnweighted,
|
|
arg.TagsCsv,
|
|
)
|
|
}
|
|
|
|
const listSprintParts = `-- name: ListSprintParts :many
|
|
SELECT sprint_id, object_id, required
|
|
FROM sprint_part
|
|
WHERE sprint_id = ?
|
|
`
|
|
|
|
func (q *Queries) ListSprintParts(ctx context.Context, sprintID int) ([]SprintPart, error) {
|
|
rows, err := q.query(ctx, q.listSprintPartsStmt, listSprintParts, sprintID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
items := []SprintPart{}
|
|
for rows.Next() {
|
|
var i SprintPart
|
|
if err := rows.Scan(&i.SprintID, &i.ObjectID, &i.Required); 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 listSprintsAt = `-- name: ListSprintsAt :many
|
|
SELECT id, scope_id, name, description, from_time, to_time, is_timed, is_coarse, is_unweighted, kind, aggregate_name, aggregate_required, tags_csv
|
|
FROM sprint
|
|
WHERE scope_id = ?
|
|
AND from_time <= ?
|
|
AND to_time > ?
|
|
`
|
|
|
|
type ListSprintsAtParams struct {
|
|
ScopeID int
|
|
Time time.Time
|
|
}
|
|
|
|
func (q *Queries) ListSprintsAt(ctx context.Context, arg ListSprintsAtParams) ([]Sprint, error) {
|
|
rows, err := q.query(ctx, q.listSprintsAtStmt, listSprintsAt, arg.ScopeID, arg.Time, arg.Time)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
items := []Sprint{}
|
|
for rows.Next() {
|
|
var i Sprint
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.ScopeID,
|
|
&i.Name,
|
|
&i.Description,
|
|
&i.FromTime,
|
|
&i.ToTime,
|
|
&i.IsTimed,
|
|
&i.IsCoarse,
|
|
&i.IsUnweighted,
|
|
&i.Kind,
|
|
&i.AggregateName,
|
|
&i.AggregateRequired,
|
|
&i.TagsCsv,
|
|
); 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 listSprintsBetween = `-- name: ListSprintsBetween :many
|
|
SELECT id, scope_id, name, description, from_time, to_time, is_timed, is_coarse, is_unweighted, kind, aggregate_name, aggregate_required, tags_csv
|
|
FROM sprint
|
|
WHERE scope_id = ?
|
|
AND from_time < ?
|
|
AND to_time >= ?
|
|
ORDER BY from_time, name
|
|
`
|
|
|
|
type ListSprintsBetweenParams struct {
|
|
ScopeID int
|
|
ToTime time.Time
|
|
FromTime time.Time
|
|
}
|
|
|
|
func (q *Queries) ListSprintsBetween(ctx context.Context, arg ListSprintsBetweenParams) ([]Sprint, error) {
|
|
rows, err := q.query(ctx, q.listSprintsBetweenStmt, listSprintsBetween, arg.ScopeID, arg.ToTime, arg.FromTime)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
items := []Sprint{}
|
|
for rows.Next() {
|
|
var i Sprint
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.ScopeID,
|
|
&i.Name,
|
|
&i.Description,
|
|
&i.FromTime,
|
|
&i.ToTime,
|
|
&i.IsTimed,
|
|
&i.IsCoarse,
|
|
&i.IsUnweighted,
|
|
&i.Kind,
|
|
&i.AggregateName,
|
|
&i.AggregateRequired,
|
|
&i.TagsCsv,
|
|
); 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 replaceSprintPart = `-- name: ReplaceSprintPart :exec
|
|
REPLACE INTO sprint_part (sprint_id, object_id, required)
|
|
VALUES (?, ?, ?)
|
|
`
|
|
|
|
type ReplaceSprintPartParams struct {
|
|
SprintID int
|
|
ObjectID int
|
|
Required int
|
|
}
|
|
|
|
func (q *Queries) ReplaceSprintPart(ctx context.Context, arg ReplaceSprintPartParams) error {
|
|
_, err := q.exec(ctx, q.replaceSprintPartStmt, replaceSprintPart, arg.SprintID, arg.ObjectID, arg.Required)
|
|
return err
|
|
}
|
|
|
|
const updateSprint = `-- name: UpdateSprint :exec
|
|
UPDATE sprint
|
|
SET name = ?,
|
|
description = ?,
|
|
from_time = ?,
|
|
to_time = ?,
|
|
is_timed = ?,
|
|
is_coarse = ?,
|
|
is_unweighted = ?,
|
|
aggregate_name = ?,
|
|
aggregate_required = ?,
|
|
tags_csv = ?
|
|
WHERE id = ?
|
|
`
|
|
|
|
type UpdateSprintParams struct {
|
|
Name string
|
|
Description string
|
|
FromTime time.Time
|
|
ToTime time.Time
|
|
IsTimed bool
|
|
IsCoarse bool
|
|
IsUnweighted bool
|
|
AggregateName string
|
|
AggregateRequired int
|
|
TagsCsv sql.NullString
|
|
ID int
|
|
}
|
|
|
|
func (q *Queries) UpdateSprint(ctx context.Context, arg UpdateSprintParams) error {
|
|
_, err := q.exec(ctx, q.updateSprintStmt, updateSprint,
|
|
arg.Name,
|
|
arg.Description,
|
|
arg.FromTime,
|
|
arg.ToTime,
|
|
arg.IsTimed,
|
|
arg.IsCoarse,
|
|
arg.IsUnweighted,
|
|
arg.AggregateName,
|
|
arg.AggregateRequired,
|
|
arg.TagsCsv,
|
|
arg.ID,
|
|
)
|
|
return err
|
|
}
|