From 19af887b3879d79304292e0d9c695e8364aeb9f1 Mon Sep 17 00:00:00 2001 From: Blake Gentry Date: Thu, 29 Aug 2024 21:31:56 -0500 Subject: [PATCH] minor documentation improvements --- job.go | 3 +++ worker.go | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/job.go b/job.go index c843ad3d..0954fec8 100644 --- a/job.go +++ b/job.go @@ -15,6 +15,9 @@ type Job[T JobArgs] struct { // JobArgs is an interface that represents the arguments for a job of type T. // These arguments are serialized into JSON and stored in the database. +// +// The struct is serialized using `encoding/json`. All exported fields are +// serialized, unless skipped with a struct field tag. type JobArgs interface { // Kind is a string that uniquely identifies the type of job. This must be // provided on your job arguments struct. diff --git a/worker.go b/worker.go index 73714730..f4af8b37 100644 --- a/worker.go +++ b/worker.go @@ -9,9 +9,10 @@ import ( ) // Worker is an interface that can perform a job with args of type T. A typical -// Worker implementation will be a struct that embeds WorkerDefaults, implements -// `Kind()` and `Work()`, and optionally overrides other methods to provide -// job-specific configuration for all jobs of that type: +// implementation will be a JSON-serializable `JobArgs` struct that implements +// `Kind()`, along with a Worker that embeds WorkerDefaults and implements `Work()`. +// Workers may optionally override other methods to provide job-specific +// configuration for all jobs of that type: // // type SleepArgs struct { // Duration time.Duration `json:"duration"`