Documentation ¶
Overview ¶
Package job is used to run a daemon to run batch jobs on a schedule
Index ¶
- Variables
- func CreateSchema(ctx context.Context, conn *pgx.Conn) error
- type Entry
- func (j *Entry) Exec(ctx context.Context, sql string, args ...any) error
- func (e *Entry) GetEtag(nurl *url.URL) (string, error)
- func (e *Entry) GetParm(key string, seq int, val any) error
- func (j *Entry) LogMultiLineString(s string)
- func (j *Entry) RunCmd(ctx context.Context, cmdstr string) error
- func (e *Entry) SetEtag(nurl *url.URL, etag string) error
- func (e *Entry) SetParm(key string, seq int, p any) error
- type Manager
- type ManagerOptions
- type RunCallback
Constants ¶
This section is empty.
Variables ¶
var LogDivider = strings.Repeat("=", 80)
LogDivider can be used to divide logical sections in the log output.
Functions ¶
func CreateSchema ¶
CreateSchema will create the job schema and associated tables needed for this package to run
Types ¶
type Entry ¶
type Entry struct { App string Env string URL string RootDir string JobID int RunID int Name string NameKey string Fun string DB *pgxpool.Pool Log *logging.Logger Ctx context.Context }
Entry stores resources and information about running jobs. Can be used by running jobs to call utility methods.
func (*Entry) Exec ¶
Exec runs an SQL statement that does not need results back. The function Will print the query and then log rows affected and runtime when finished.
func (*Entry) LogMultiLineString ¶
LogMultiLineString prints out a multiline string and prints a line number for each line
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is an instance of a job manager.
func NewManager ¶
func NewManager(options *ManagerOptions) (*Manager, error)
NewManager initializes a new job manager and returns a pointer.
type ManagerOptions ¶
type ManagerOptions struct { App string Env string URL string DB *pgxpool.Pool RootDir string LogDir string ScanInterval time.Duration MaxConcurrency int RunCallback RunCallback }
ManagerOptions contain the settings to use when creating a new job manager instance.
type RunCallback ¶
RunCallback will be called to run the submitted process.