{{- $pkg := env "PWD" | base | coalesce Package -}} package {{$pkg}} import ( "context" "fmt" "log/slog" "reflect" "gfx.cafe/util/go/fxriver" "github.com/riverqueue/river" "go.uber.org/fx" ) var ( packageName = reflect.TypeOf(Args{}).PkgPath() ) type Args struct { } func (a *Args) Kind() string { return packageName + ".task" } type Worker struct { river.WorkerDefaults[*Args] log *slog.Logger } type Params struct { fx.In Ctx context.Context Lc fx.Lifecycle Log *slog.Logger } type Result struct { fx.Out Output fxriver.WorkConfigurer `group:"river_worker"` } func New(p Params) (r Result, err error) { o := &Worker{} o.log = p.Log r.Output = fxriver.Wrap(o) return } func (o *Worker) Work(ctx context.Context, job *river.Job[*Args]) error { return fmt.Errorf("Job %s is not implemented", (&Args{}).Kind()) }