jobs

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UserMaintenanceWorker jobs.Job = &UserMaintenanceJob{}

Functions

This section is empty.

Types

type UserMaintenanceJob

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

UserMaintenanceJob represents a job that can be scheduled and run periodically.

Fields:

databaseAccessors []func() ([]*database.DB, error) (optional): A slice of functions that return database instances.
  Uncomment this field for multi-database jobs.

Methods:

Name() string:
  Returns the name of the job.

Schedule() string:
  Returns the schedule for the job in cron format.

Description() string:
  Returns a description of the job.

Run() error:
  Executes the job. Starts a timing clock, runs pre-processing, processes the job, runs post-processing, and stops the clock.
  Returns an error if any step fails.

Service() func():
  Returns a function that runs the job and logs any errors.

AddDatabaseAccessFunctions(fn func() ([]*database.DB, error)):
  Adds a function to the databaseAccessors slice. This method is currently not implemented and will panic if called.

Example usage:

job := &UserMaintenanceJob{}
job.Service()()

func (*UserMaintenanceJob) AddDatabaseAccessFunctions

func (job *UserMaintenanceJob) AddDatabaseAccessFunctions(fn func() ([]*database.DB, error))

AddDatabaseAccessFunctions adds a function to the databaseAccessors slice.

This method is currently not implemented and will panic if called.

Parameters:

fn func() ([]*database.DB, error): A function that returns a slice of pointers to `database.DB` and an error.

func (*UserMaintenanceJob) Description

func (j *UserMaintenanceJob) Description() string

Description returns a description of the job.

Returns:

string: A description of the job.

func (*UserMaintenanceJob) Name

func (j *UserMaintenanceJob) Name() string

Name returns the name of the job.

Returns:

string: The name of the job.

func (*UserMaintenanceJob) Run

func (j *UserMaintenanceJob) Run() error

Run executes the job. Starts a timing clock, runs pre-processing, processes the job, runs post-processing, and stops the clock.

Returns:

error: An error if any step fails, otherwise nil.

func (*UserMaintenanceJob) Schedule

func (j *UserMaintenanceJob) Schedule() string

Schedule returns the schedule for the job in cron format.

Returns:

string: The schedule for the job in quartz cron format.

func (*UserMaintenanceJob) Service

func (j *UserMaintenanceJob) Service() func()

Service returns a function that runs the job and logs any errors.

Returns:

func(): A function that runs the job and logs any errors.

Jump to

Keyboard shortcuts

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