jobber

package
v0.0.0-...-daae6f8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package jobber orchestrates scheduled scraping of job offers from external sources based on user-defined search queries. It manages query lifecycle (creation, scheduling, expiration), persists results to a database, and automatically prunes stale queries after 7 days of inactivity. Each query runs on an hourly cron schedule, deduplicates offers, and maintains query-offer associations for efficient retrieval.

Index

Constants

This section is empty.

Variables

View Source
var ErrTimedOut = errors.New("operation timed out")

Functions

This section is empty.

Types

type Jobber

type Jobber struct {
	// contains filtered or unexported fields
}

func New

func New(log *slog.Logger, db *db.Queries, opts ...Options) (*Jobber, func())

func (*Jobber) CreateQuery

func (j *Jobber) CreateQuery(keywords, location string) error

CreateQuery creates a new query, schedules it for future runs and also runs it immediately. While running it immediately it will block the caller until the job finishes or it times out.

func (*Jobber) ListOffers

func (j *Jobber) ListOffers(ctx context.Context, gqp *db.GetQueryParams) ([]*db.Offer, *pgtype.Timestamptz, error)

ListOffers return the list of offers for a given query's keywords and location and the last time the query was updated to calculate the Cache-Control header. Returns sql.ErrNoRows for non-existent query.

type Options

type Options func(*Jobber)

func WithScrapeList

func WithScrapeList(sl scrape.List) Options

func WithTimeOut

func WithTimeOut(t time.Duration) Options

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL