67 lines
1.6 KiB
Go
67 lines
1.6 KiB
Go
|
// Code generated by sqlc. DO NOT EDIT.
|
||
|
// source: task_assigned.sql
|
||
|
|
||
|
package pg
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"time"
|
||
|
|
||
|
"github.com/google/uuid"
|
||
|
)
|
||
|
|
||
|
const createTaskAssigned = `-- name: CreateTaskAssigned :one
|
||
|
INSERT INTO task_assigned (task_id, user_id, assigned_date)
|
||
|
VALUES($1, $2, $3) RETURNING task_assigned_id, task_id, user_id, assigned_date
|
||
|
`
|
||
|
|
||
|
type CreateTaskAssignedParams struct {
|
||
|
TaskID uuid.UUID `json:"task_id"`
|
||
|
UserID uuid.UUID `json:"user_id"`
|
||
|
AssignedDate time.Time `json:"assigned_date"`
|
||
|
}
|
||
|
|
||
|
func (q *Queries) CreateTaskAssigned(ctx context.Context, arg CreateTaskAssignedParams) (TaskAssigned, error) {
|
||
|
row := q.db.QueryRowContext(ctx, createTaskAssigned, arg.TaskID, arg.UserID, arg.AssignedDate)
|
||
|
var i TaskAssigned
|
||
|
err := row.Scan(
|
||
|
&i.TaskAssignedID,
|
||
|
&i.TaskID,
|
||
|
&i.UserID,
|
||
|
&i.AssignedDate,
|
||
|
)
|
||
|
return i, err
|
||
|
}
|
||
|
|
||
|
const getAssignedMembersForTask = `-- name: GetAssignedMembersForTask :many
|
||
|
SELECT task_assigned_id, task_id, user_id, assigned_date FROM task_assigned WHERE task_id = $1
|
||
|
`
|
||
|
|
||
|
func (q *Queries) GetAssignedMembersForTask(ctx context.Context, taskID uuid.UUID) ([]TaskAssigned, error) {
|
||
|
rows, err := q.db.QueryContext(ctx, getAssignedMembersForTask, taskID)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
defer rows.Close()
|
||
|
var items []TaskAssigned
|
||
|
for rows.Next() {
|
||
|
var i TaskAssigned
|
||
|
if err := rows.Scan(
|
||
|
&i.TaskAssignedID,
|
||
|
&i.TaskID,
|
||
|
&i.UserID,
|
||
|
&i.AssignedDate,
|
||
|
); 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
|
||
|
}
|