internal/jobs persists jobs in the jobs table, which is also the queue: a
bounded pool of workers claims queued jobs oldest first. Handlers are
registered per kind before Start with typed payloads and results, and can
publish partial results to the row while they run. Only typed results and
*jobs.Failure messages are stored; any other handler error is logged and
stored as "internal error", so dependency error text cannot surface a
secret. Start fails jobs a previous process left running with
"interrupted by restart" before any worker runs.
GET /api/v1/jobs/{id} returns {id, kind, status, result, error} inside the
protected /api/v1 group; an unknown id is a 404 not_found.
Migration 0003_jobs_status rebuilds jobs with status queued, running,
succeeded, failed, mapping legacy pending and done rows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
78 lines
4.1 KiB
Go
78 lines
4.1 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.31.1
|
|
|
|
package db
|
|
|
|
import (
|
|
"context"
|
|
"database/sql"
|
|
)
|
|
|
|
type Querier interface {
|
|
// An unknown id returns sql.ErrNoRows.
|
|
ArchiveDinner(ctx context.Context, arg ArchiveDinnerParams) (Dinner, error)
|
|
// Marks the oldest queued job running and returns it. Returns sql.ErrNoRows
|
|
// when no job is queued.
|
|
ClaimNextJob(ctx context.Context, now sql.NullString) (Job, error)
|
|
CreateDinner(ctx context.Context, arg CreateDinnerParams) (Dinner, error)
|
|
CreateJob(ctx context.Context, arg CreateJobParams) error
|
|
CreatePhoto(ctx context.Context, arg CreatePhotoParams) (Photo, error)
|
|
CreateRecipeIngredient(ctx context.Context, arg CreateRecipeIngredientParams) error
|
|
CreateRecipeStep(ctx context.Context, arg CreateRecipeStepParams) error
|
|
DeleteRecipeIngredients(ctx context.Context, recipeID string) error
|
|
DeleteRecipeSteps(ctx context.Context, recipeID string) error
|
|
FailJob(ctx context.Context, arg FailJobParams) (int64, error)
|
|
// Fails every job left running, at boot before any worker starts.
|
|
FailRunningJobs(ctx context.Context, arg FailRunningJobsParams) (int64, error)
|
|
// Returns sql.ErrNoRows until the row exists.
|
|
GetAISettings(ctx context.Context) (AiSetting, error)
|
|
// Returns sql.ErrNoRows until the row exists.
|
|
GetChatSettings(ctx context.Context) (ChatSetting, error)
|
|
GetDinner(ctx context.Context, id string) (Dinner, error)
|
|
// Returns sql.ErrNoRows until the row exists.
|
|
GetHouseholdSettings(ctx context.Context) (HouseholdSetting, error)
|
|
// Returns sql.ErrNoRows until the row exists.
|
|
GetIntegrationsGoogle(ctx context.Context) (IntegrationsGoogle, error)
|
|
GetJob(ctx context.Context, id string) (Job, error)
|
|
// Finds stored image bytes by content hash. The schema does not make sha256
|
|
// unique, so the earliest-created (lowest id) match is returned.
|
|
GetPhotoBySHA256(ctx context.Context, sha256 string) (Photo, error)
|
|
GetRecipe(ctx context.Context, id string) (Recipe, error)
|
|
GetRecipeBySourceURL(ctx context.Context, sourceUrl string) (Recipe, error)
|
|
// Returns sql.ErrNoRows until the row exists.
|
|
GetRecipeSearchSettings(ctx context.Context) (RecipeSearchSetting, error)
|
|
ListDinnersByStatus(ctx context.Context, status string) ([]Dinner, error)
|
|
ListRecipeIngredients(ctx context.Context, recipeID string) ([]RecipeIngredient, error)
|
|
ListRecipeSteps(ctx context.Context, recipeID string) ([]RecipeStep, error)
|
|
// Stores a partial result of a running job.
|
|
PublishJobResult(ctx context.Context, arg PublishJobResultParams) (int64, error)
|
|
// An unknown id returns sql.ErrNoRows.
|
|
SetDinnerFavorite(ctx context.Context, arg SetDinnerFavoriteParams) (Dinner, error)
|
|
SucceedJob(ctx context.Context, arg SucceedJobParams) (int64, error)
|
|
// An unknown id returns sql.ErrNoRows.
|
|
UpdateDinner(ctx context.Context, arg UpdateDinnerParams) (Dinner, error)
|
|
// Creates the single row (id 1) or replaces every column except id and
|
|
// created_at.
|
|
UpsertAISettings(ctx context.Context, arg UpsertAISettingsParams) (AiSetting, error)
|
|
// Creates the single row (id 1) or replaces every column except id and
|
|
// created_at.
|
|
UpsertChatSettings(ctx context.Context, arg UpsertChatSettingsParams) (ChatSetting, error)
|
|
// Creates the single row (id 1) or replaces every column except id and
|
|
// created_at.
|
|
UpsertHouseholdSettings(ctx context.Context, arg UpsertHouseholdSettingsParams) (HouseholdSetting, error)
|
|
// Creates the single row (id 1) or replaces every column except id and
|
|
// created_at.
|
|
UpsertIntegrationsGoogle(ctx context.Context, arg UpsertIntegrationsGoogleParams) (IntegrationsGoogle, error)
|
|
// A recipe is keyed by source_url: re-fetching the same URL updates the
|
|
// existing row and keeps its id and created_at, which the returned row
|
|
// carries. Replace its ingredients and steps in the same transaction with
|
|
// DeleteRecipeIngredients/DeleteRecipeSteps then the Create queries.
|
|
UpsertRecipe(ctx context.Context, arg UpsertRecipeParams) (Recipe, error)
|
|
// Creates the single row (id 1) or replaces every column except id and
|
|
// created_at.
|
|
UpsertRecipeSearchSettings(ctx context.Context, arg UpsertRecipeSearchSettingsParams) (RecipeSearchSetting, error)
|
|
}
|
|
|
|
var _ Querier = (*Queries)(nil)
|