63 lines
1.4 KiB
Go
63 lines
1.4 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.29.0
|
|
// source: queries-processing_jobs.sql
|
|
|
|
package sqlc
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
const createProcessingJob = `-- name: CreateProcessingJob :one
|
|
INSERT INTO processing_jobs (
|
|
file_id, job_type
|
|
) VALUES ($1,$2 )
|
|
RETURNING id, file_id, created, started, completed, status, job_type
|
|
`
|
|
|
|
type CreateProcessingJobParams struct {
|
|
FileID pgtype.UUID
|
|
JobType pgtype.Text
|
|
}
|
|
|
|
func (q *Queries) CreateProcessingJob(ctx context.Context, arg CreateProcessingJobParams) (ProcessingJob, error) {
|
|
row := q.db.QueryRow(ctx, createProcessingJob, arg.FileID, arg.JobType)
|
|
var i ProcessingJob
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.FileID,
|
|
&i.Created,
|
|
&i.Started,
|
|
&i.Completed,
|
|
&i.Status,
|
|
&i.JobType,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const finishProcessingJob = `-- name: FinishProcessingJob :exec
|
|
UPDATE processing_jobs
|
|
SET completed = NOW(),
|
|
status = "completed"
|
|
WHERE id = $1
|
|
`
|
|
|
|
func (q *Queries) FinishProcessingJob(ctx context.Context, id int32) error {
|
|
_, err := q.db.Exec(ctx, finishProcessingJob, id)
|
|
return err
|
|
}
|
|
|
|
const startProcessingJob = `-- name: StartProcessingJob :exec
|
|
UPDATE processing_jobs
|
|
SET started = NOW(),
|
|
status = "started"
|
|
WHERE id = $1
|
|
`
|
|
|
|
func (q *Queries) StartProcessingJob(ctx context.Context, id int32) error {
|
|
_, err := q.db.Exec(ctx, startProcessingJob, id)
|
|
return err
|
|
}
|