Files
query-orchestration/internal/database/repository/job.sql.go
T

58 lines
1.3 KiB
Go
Raw Normal View History

2025-01-23 14:56:20 +00:00
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.27.0
// source: job.sql
package repository
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
)
const createJob = `-- name: CreateJob :one
INSERT INTO jobs (clientId) VALUES ($1) RETURNING id
`
// CreateJob
//
// INSERT INTO jobs (clientId) VALUES ($1) RETURNING id
func (q *Queries) CreateJob(ctx context.Context, clientid pgtype.UUID) (pgtype.UUID, error) {
row := q.db.QueryRow(ctx, createJob, clientid)
var id pgtype.UUID
err := row.Scan(&id)
return id, err
}
const getJob = `-- name: GetJob :one
SELECT id, clientId, canSync FROM jobs WHERE id = $1 LIMIT 1
`
// GetJob
//
// SELECT id, clientId, canSync FROM jobs WHERE id = $1 LIMIT 1
func (q *Queries) GetJob(ctx context.Context, id pgtype.UUID) (*Job, error) {
row := q.db.QueryRow(ctx, getJob, id)
var i Job
err := row.Scan(&i.ID, &i.Clientid, &i.Cansync)
return &i, err
}
const updateJob = `-- name: UpdateJob :exec
UPDATE jobs SET canSync = $1 WHERE id = $2
`
type UpdateJobParams struct {
Cansync bool `db:"cansync"`
ID pgtype.UUID `db:"id"`
}
// UpdateJob
//
// UPDATE jobs SET canSync = $1 WHERE id = $2
func (q *Queries) UpdateJob(ctx context.Context, arg *UpdateJobParams) error {
_, err := q.db.Exec(ctx, updateJob, arg.Cansync, arg.ID)
return err
}