jobs

package
v0.0.0-...-50f4634 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobNameUserCsvImport = "UserCsvImport"
	JobNameDatabaseReset = "DatabaseReset"
)

Variables

View Source
var ErrClient = &ClientError{}
View Source
var (
	ErrItemSkip = errors.New("item skip")
)
View Source
var ErrJobOverflow = errors.New("Job Overflow")

Functions

func CleanOutdatedJobs

func CleanOutdatedJobs()

------------------------------------ CleanOutdatedJobs iterate schemas to clean outdated jobs

func NewClientError

func NewClientError(err error) error

func NewDatabaseResetJob

func NewDatabaseResetJob(tt tenant.Tenant, job *xjm.Job) iRunner

func NewUserCsvImportJob

func NewUserCsvImportJob(tt tenant.Tenant, job *xjm.Job) iRunner

func Reappend

func Reappend()

------------------------------------

func StartJobs

func StartJobs(tt tenant.Tenant) error

StartJobs start tenant jobs

func Starts

func Starts()

Starts iterate tenants to start jobs

func Stats

func Stats() string

Types

type ArgFilter

type ArgFilter struct {
	Start time.Time `form:"start" json:"start,omitempty"`
	End   time.Time `form:"end" json:"end,omitempty"`
	Items int       `form:"items" json:"items,omitempty"`
}

func (*ArgFilter) Bind

func (af *ArgFilter) Bind(c *xin.Context, a any) error

type ArgLocale

type ArgLocale struct {
	Locale string `json:"locale,omitempty"`
}

type ClientError

type ClientError struct {
	Err error
}

func (*ClientError) Error

func (ce *ClientError) Error() string

func (*ClientError) Is

func (ce *ClientError) Is(err error) (ok bool)

func (*ClientError) Unwrap

func (ce *ClientError) Unwrap() error

type DatabaseResetArg

type DatabaseResetArg ArgLocale

type DatabaseResetJob

type DatabaseResetJob struct {
	*JobRunner
	// contains filtered or unexported fields
}

func (*DatabaseResetJob) Run

func (dr *DatabaseResetJob) Run()

type FailedItem

type FailedItem struct {
	ID    int64  `json:"id"`
	Title string `json:"title"`
	Error string `json:"error"`
}

func (*FailedItem) Quoted

func (si *FailedItem) Quoted() string

func (*FailedItem) String

func (si *FailedItem) String() string

type JobRunner

type JobRunner struct {
	*xjm.JobRunner

	Tenant tenant.Tenant
}

func (*JobRunner) AddFailedItem

func (jr *JobRunner) AddFailedItem(id int64, title, reason string)

func (*JobRunner) Done

func (jr *JobRunner) Done(err error)

func (*JobRunner) Running

func (jr *JobRunner) Running(state any) error

type JobRunnerCreator

type JobRunnerCreator func(tenant.Tenant, *xjm.Job) iRunner

type JobState

type JobState struct {
	Step    int `json:"step,omitempty"`
	Total   int `json:"total,omitempty"`
	Limit   int `json:"limit,omitempty"`
	Skipped int `json:"skipped,omitempty"`
	Success int `json:"success,omitempty"`
	Failure int `json:"failure,omitempty"`
}

func (*JobState) Progress

func (js *JobState) Progress() string

func (*JobState) State

func (js *JobState) State() JobState

func (*JobState) String

func (js *JobState) String() string

type JobStateEx

type JobStateEx struct {
	JobState
	LastID int64 `json:"last_id,omitempty"`
}

func (*JobStateEx) String

func (jse *JobStateEx) String() string

type TenantJobs

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

func NewTenantJobs

func NewTenantJobs() *TenantJobs

func (*TenantJobs) Add

func (tj *TenantJobs) Add(tt tenant.Tenant, job *xjm.Job)

func (*TenantJobs) Count

func (tj *TenantJobs) Count(tt tenant.Tenant) int

func (*TenantJobs) Del

func (tj *TenantJobs) Del(tt tenant.Tenant, job *xjm.Job)

func (*TenantJobs) Stats

func (tj *TenantJobs) Stats() string

func (*TenantJobs) Total

func (tj *TenantJobs) Total() int

type UserCsvImportArg

type UserCsvImportArg ArgLocale

type UserCsvImportJob

type UserCsvImportJob struct {
	*JobRunner

	JobState
	// contains filtered or unexported fields
}

func (*UserCsvImportJob) Run

func (uci *UserCsvImportJob) Run()

Jump to

Keyboard shortcuts

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