job

package
v0.0.0-...-153da20 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WORKER_JOB   = "job"
	WORKER_EMAIL = "email"
)
View Source
const JOB_STATUS_DONE = "DONE"
View Source
const JOB_STATUS_PENDING = "PENDING"
View Source
const JOB_STATUS_PROCESSING = "PROCESSING"
View Source
const JOB_TYPE_IMPORT_USERS = "IMPORT_USERS"

Variables

View Source
var JobRequests = make(chan Job)

Functions

This section is empty.

Types

type Job

type Job struct {
	ID          string `bson:"_id,omitempty" json:"id,omitempty"`
	Type        string `bson:"type" json:"type" validate:"required"`
	Status      string `bson:"status" json:"status" validate:"required"`
	InitiatedBy string `bson:"initiated_by" json:"initiated_by" validate:"required"`
	SourceFile  string `bson:"source_file" json:"source_file"`
	Created     string `bson:"created" json:"created"`
	Modified    string `bson:"modified" json:"modified"`
}

func CreateNewJob

func CreateNewJob(c context.Context, jobType string, sourceFile string) (*Job, error)

func NewJob

func NewJob(opts ...Option) (*Job, error)

func (Job) AddToJobQueue

func (job Job) AddToJobQueue() (string, error)

func (*Job) GetObjectID

func (b *Job) GetObjectID() primitive.ObjectID

func (*Job) GetOne

func (job *Job) GetOne(c context.Context) error

func (Job) Notify

func (job Job) Notify() (string, error)

func (*Job) ProcessJob

func (job *Job) ProcessJob(ctx context.Context) error

func (*Job) SetStatus

func (b *Job) SetStatus(status string) error

func (*Job) Store

func (job *Job) Store(c context.Context) error

func (*Job) Update

func (job *Job) Update(c context.Context) error

func (*Job) Validate

func (b *Job) Validate() error

type Option

type Option func(*Job) error

func ID

func ID(id string) Option

func InitiatedBy

func InitiatedBy(userId string) Option

func SourceFile

func SourceFile(filepath string) Option

func Status

func Status(status string) Option

func Type

func Type(t string) Option

Jump to

Keyboard shortcuts

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