// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.25.0 // source: query.sql package sqlc import ( "context" "database/sql" "encoding/json" "time" ) const createJob = `-- name: CreateJob :exec INSERT INTO jobs ( created_at, uuid, name, job_type, priority, status, activity, settings, metadata, storage_shaman_checkout_id ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) ` type CreateJobParams struct { CreatedAt time.Time UUID string Name string JobType string Priority int64 Status string Activity string Settings json.RawMessage Metadata json.RawMessage StorageShamanCheckoutID string } // Jobs / Tasks queries func (q *Queries) CreateJob(ctx context.Context, arg CreateJobParams) error { _, err := q.db.ExecContext(ctx, createJob, arg.CreatedAt, arg.UUID, arg.Name, arg.JobType, arg.Priority, arg.Status, arg.Activity, arg.Settings, arg.Metadata, arg.StorageShamanCheckoutID, ) return err } const deleteJob = `-- name: DeleteJob :exec DELETE FROM jobs WHERE uuid = ? ` func (q *Queries) DeleteJob(ctx context.Context, uuid string) error { _, err := q.db.ExecContext(ctx, deleteJob, uuid) return err } const fetchJob = `-- name: FetchJob :one SELECT id, created_at, updated_at, uuid, name, job_type, priority, status, activity, settings, metadata, delete_requested_at, storage_shaman_checkout_id, worker_tag_id FROM jobs WHERE uuid = ? LIMIT 1 ` func (q *Queries) FetchJob(ctx context.Context, uuid string) (Job, error) { row := q.db.QueryRowContext(ctx, fetchJob, uuid) var i Job err := row.Scan( &i.ID, &i.CreatedAt, &i.UpdatedAt, &i.UUID, &i.Name, &i.JobType, &i.Priority, &i.Status, &i.Activity, &i.Settings, &i.Metadata, &i.DeleteRequestedAt, &i.StorageShamanCheckoutID, &i.WorkerTagID, ) return i, err } const fetchTask = `-- name: FetchTask :one SELECT id, created_at, updated_at, uuid, name, type, job_id, priority, status, worker_id, last_touched_at, commands, activity FROM tasks WHERE uuid = ? LIMIT 1 ` func (q *Queries) FetchTask(ctx context.Context, uuid string) (Task, error) { row := q.db.QueryRowContext(ctx, fetchTask, uuid) var i Task err := row.Scan( &i.ID, &i.CreatedAt, &i.UpdatedAt, &i.UUID, &i.Name, &i.Type, &i.JobID, &i.Priority, &i.Status, &i.WorkerID, &i.LastTouchedAt, &i.Commands, &i.Activity, ) return i, err } const requestJobDeletion = `-- name: RequestJobDeletion :exec UPDATE jobs SET updated_at = ?1, delete_requested_at = ?1 WHERE id = ?2 ` type RequestJobDeletionParams struct { Now sql.NullTime JobID int64 } func (q *Queries) RequestJobDeletion(ctx context.Context, arg RequestJobDeletionParams) error { _, err := q.db.ExecContext(ctx, requestJobDeletion, arg.Now, arg.JobID) return err }