Documentation ¶
Overview ¶
package jobs contains the jobs that can be used in the river server
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMissingTestDir is the error for missing test directory ErrMissingTestDir = errors.New("missing test directory in email config") // ErrMissingToken is the error for missing token ErrMissingToken = errors.New("missing resend api token, set token or use dev mode") )
Functions ¶
This section is empty.
Types ¶
type DatabaseArgs ¶ added in v0.0.2
type DatabaseArgs struct { // OrganizationID is the organization id to create the database for OrganizationID string `json:"organization_id"` // Location is the location to create the database in, e.g. AMER Location string `json:"location"` }
DatabaseArgs are the arguments for the database worker
func (DatabaseArgs) Kind ¶ added in v0.0.2
func (DatabaseArgs) Kind() string
Kind satisfies the river.Args interface for the database worker
type DatabaseWorker ¶ added in v0.0.2
type DatabaseWorker struct { river.WorkerDefaults[DatabaseArgs] Config dbx.Config `koanf:"config" json:"config" jsonschema:"description=the database configuration"` }
DatabaseWorker is a worker to create a dedicated database for an organization
func (*DatabaseWorker) Work ¶ added in v0.0.2
func (w *DatabaseWorker) Work(ctx context.Context, job *river.Job[DatabaseArgs]) error
Work satisfies the river.Worker interface for the database worker it creates a dedicated database using the dbx client for the organization
type EmailArgs ¶
type EmailArgs struct { // Message is the email message to send Message newman.EmailMessage `json:"message"` }
EmailArgs for the email worker to process the job
type EmailConfig ¶
type EmailConfig struct { // DevMode is a flag to enable dev mode DevMode bool `koanf:"devMode" json:"devMode" jsonschema:"description=enable dev mode" default:"true"` // TestDir is the directory to use for dev mode TestDir string `koanf:"testDir" json:"testDir" jsonschema:"description=the directory to use for dev mode" default:"fixtures/email"` // Token is the token to use for the email provider Token string `koanf:"token" json:"token" jsonschema:"description=the token to use for the email provider"` // FromEmail is the email address to use as the sender FromEmail string `` /* 138-byte string literal not displayed */ }
EmailConfig contains the configuration for the email worker
type EmailWorker ¶
type EmailWorker struct { river.WorkerDefaults[EmailArgs] Config EmailConfig `koanf:"config" json:"config" jsonschema:"description=the email configuration"` }
EmailWorker is a worker to send emails using the resend email provider the config defaults to dev mode, which will write the email to a file using the mock provider a token is required to send emails using the actual resend provider
type MissingRequiredArgError ¶ added in v0.0.2
type MissingRequiredArgError struct { // Arg is the required argument that was not provided Arg string `json:"arg"` // Job is the job that requires the argument Job string `json:"job"` }
MissingRequiredArg is returned when a required argument was not provided to a job
func (*MissingRequiredArgError) Error ¶ added in v0.0.2
func (e *MissingRequiredArgError) Error() string
Error returns the MissingRequiredArgError in string format