job

package
v0.6.2-beta Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	Name       string
	MethodName string
	Params     Param
	Queue      string
}

Job structure will be used to handle every jobs. Every method (except "Schedule" and "Execute") accept only one string parameter. This param will be decoded into a specific structure (manually defined into your job). Redis and MySQL is mandatory to use this feature. Redis will be used to handle every queue and MySQL to store failed jobs.

func (*Job) Execute

func (j *Job) Execute()

Execute specific job

func (Job) Mail

func (Job) Mail(payload string) (bool, error)

Mail method will sends an email The payload must be a JSON object compliant with the MailStruct structure.

func (Job) PutOnFailed

func (Job) PutOnFailed(queue, payload string, db *gorm.DB, err error)

PutOnFailed inserts failed job in failed_job table

func (*Job) Schedule

func (j *Job) Schedule(queueName string, redis *redis.Client)

Schedule specific job

type MailStruct

type MailStruct struct {
	To      []string `json:"to"`
	Message string   `json:"message"`
}

type Param

type Param struct {
	Name    string
	Payload string
	Type    string
}

Jump to

Keyboard shortcuts

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