|
|
@ -12,7 +12,9 @@ import ( |
|
|
|
) |
|
|
|
|
|
|
|
const deleteAllScopeSprints = `-- name: DeleteAllScopeSprints :exec |
|
|
|
DELETE FROM sprint WHERE scope_id = ? |
|
|
|
DELETE |
|
|
|
FROM sprint |
|
|
|
WHERE scope_id = ? |
|
|
|
` |
|
|
|
|
|
|
|
func (q *Queries) DeleteAllScopeSprints(ctx context.Context, scopeID int) error { |
|
|
@ -21,7 +23,9 @@ func (q *Queries) DeleteAllScopeSprints(ctx context.Context, scopeID int) error |
|
|
|
} |
|
|
|
|
|
|
|
const deleteAllSprintParts = `-- name: DeleteAllSprintParts :exec |
|
|
|
DELETE FROM sprint_part WHERE sprint_id = ? |
|
|
|
DELETE |
|
|
|
FROM sprint_part |
|
|
|
WHERE sprint_id = ? |
|
|
|
` |
|
|
|
|
|
|
|
func (q *Queries) DeleteAllSprintParts(ctx context.Context, sprintID int) error { |
|
|
@ -30,7 +34,9 @@ func (q *Queries) DeleteAllSprintParts(ctx context.Context, sprintID int) error |
|
|
|
} |
|
|
|
|
|
|
|
const deleteSprint = `-- name: DeleteSprint :exec |
|
|
|
DELETE FROM sprint WHERE id = ? |
|
|
|
DELETE |
|
|
|
FROM sprint |
|
|
|
WHERE id = ? |
|
|
|
` |
|
|
|
|
|
|
|
func (q *Queries) DeleteSprint(ctx context.Context, id int) error { |
|
|
@ -39,7 +45,10 @@ func (q *Queries) DeleteSprint(ctx context.Context, id int) error { |
|
|
|
} |
|
|
|
|
|
|
|
const deleteSprintPart = `-- name: DeleteSprintPart :exec |
|
|
|
DELETE FROM sprint_part WHERE sprint_id = ? AND object_id = ? |
|
|
|
DELETE |
|
|
|
FROM sprint_part |
|
|
|
WHERE sprint_id = ? |
|
|
|
AND object_id = ? |
|
|
|
` |
|
|
|
|
|
|
|
type DeleteSprintPartParams struct { |
|
|
@ -53,7 +62,10 @@ func (q *Queries) DeleteSprintPart(ctx context.Context, arg DeleteSprintPartPara |
|
|
|
} |
|
|
|
|
|
|
|
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 FROM sprint WHERE id = ? AND scope_id = ? |
|
|
|
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 { |
|
|
@ -77,15 +89,16 @@ func (q *Queries) GetSprint(ctx context.Context, arg GetSprintParams) (Sprint, e |
|
|
|
&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 |
|
|
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) |
|
|
|
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 { |
|
|
@ -100,6 +113,7 @@ type InsertSprintParams struct { |
|
|
|
AggregateName string |
|
|
|
AggregateRequired int |
|
|
|
IsUnweighted bool |
|
|
|
TagsCsv sql.NullString |
|
|
|
} |
|
|
|
|
|
|
|
func (q *Queries) InsertSprint(ctx context.Context, arg InsertSprintParams) (sql.Result, error) { |
|
|
@ -115,11 +129,14 @@ func (q *Queries) InsertSprint(ctx context.Context, arg InsertSprintParams) (sql |
|
|
|
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 = ? |
|
|
|
SELECT sprint_id, object_id, required |
|
|
|
FROM sprint_part |
|
|
|
WHERE sprint_id = ? |
|
|
|
` |
|
|
|
|
|
|
|
func (q *Queries) ListSprintParts(ctx context.Context, sprintID int) ([]SprintPart, error) { |
|
|
@ -146,7 +163,11 @@ func (q *Queries) ListSprintParts(ctx context.Context, sprintID int) ([]SprintPa |
|
|
|
} |
|
|
|
|
|
|
|
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 FROM sprint WHERE scope_id = ? AND from_time <= ? AND to_time > ? |
|
|
|
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 { |
|
|
@ -176,6 +197,7 @@ func (q *Queries) ListSprintsAt(ctx context.Context, arg ListSprintsAtParams) ([ |
|
|
|
&i.Kind, |
|
|
|
&i.AggregateName, |
|
|
|
&i.AggregateRequired, |
|
|
|
&i.TagsCsv, |
|
|
|
); err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
@ -191,7 +213,8 @@ func (q *Queries) ListSprintsAt(ctx context.Context, arg ListSprintsAtParams) ([ |
|
|
|
} |
|
|
|
|
|
|
|
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 FROM sprint |
|
|
|
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 >= ? |
|
|
@ -226,6 +249,7 @@ func (q *Queries) ListSprintsBetween(ctx context.Context, arg ListSprintsBetween |
|
|
|
&i.Kind, |
|
|
|
&i.AggregateName, |
|
|
|
&i.AggregateRequired, |
|
|
|
&i.TagsCsv, |
|
|
|
); err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
@ -266,7 +290,8 @@ SET name = ?, |
|
|
|
is_coarse = ?, |
|
|
|
is_unweighted = ?, |
|
|
|
aggregate_name = ?, |
|
|
|
aggregate_required = ? |
|
|
|
aggregate_required = ?, |
|
|
|
tags_csv = ? |
|
|
|
WHERE id = ? |
|
|
|
` |
|
|
|
|
|
|
@ -280,6 +305,7 @@ type UpdateSprintParams struct { |
|
|
|
IsUnweighted bool |
|
|
|
AggregateName string |
|
|
|
AggregateRequired int |
|
|
|
TagsCsv sql.NullString |
|
|
|
ID int |
|
|
|
} |
|
|
|
|
|
|
@ -294,6 +320,7 @@ func (q *Queries) UpdateSprint(ctx context.Context, arg UpdateSprintParams) erro |
|
|
|
arg.IsUnweighted, |
|
|
|
arg.AggregateName, |
|
|
|
arg.AggregateRequired, |
|
|
|
arg.TagsCsv, |
|
|
|
arg.ID, |
|
|
|
) |
|
|
|
return err |
|
|
|