// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.23.0 // source: queries.sql package repositories import ( "context" "github.com/google/uuid" ) const getWorkers = `-- name: GetWorkers :many SELECT worker_id , capacity FROM worker_register ` type GetWorkersRow struct { WorkerID uuid.UUID `json:"worker_id"` Capacity int32 `json:"capacity"` } func (q *Queries) GetWorkers(ctx context.Context) ([]*GetWorkersRow, error) { rows, err := q.db.Query(ctx, getWorkers) if err != nil { return nil, err } defer rows.Close() items := []*GetWorkersRow{} for rows.Next() { var i GetWorkersRow if err := rows.Scan(&i.WorkerID, &i.Capacity); err != nil { return nil, err } items = append(items, &i) } if err := rows.Err(); err != nil { return nil, err } return items, nil } const ping = `-- name: Ping :one SELECT 1 ` func (q *Queries) Ping(ctx context.Context) (int32, error) { row := q.db.QueryRow(ctx, ping) var column_1 int32 err := row.Scan(&column_1) return column_1, err } const registerWorker = `-- name: RegisterWorker :exec INSERT INTO worker_register (worker_id, capacity) VALUES ( $1 , $2 ) ` type RegisterWorkerParams struct { WorkerID uuid.UUID `json:"worker_id"` Capacity int32 `json:"capacity"` } func (q *Queries) RegisterWorker(ctx context.Context, arg *RegisterWorkerParams) error { _, err := q.db.Exec(ctx, registerWorker, arg.WorkerID, arg.Capacity) return err } const updateWorkerHeartbeat = `-- name: UpdateWorkerHeartbeat :exec UPDATE worker_register SET heart_beat = now() WHERE worker_id = $1 ` func (q *Queries) UpdateWorkerHeartbeat(ctx context.Context, workerID uuid.UUID) error { _, err := q.db.Exec(ctx, updateWorkerHeartbeat, workerID) return err }