domain

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultJobPriority int32 = 30
)

Variables

View Source
var (
	JobPriority = enums.Enum{
		Items: []enums.EnumItem{{Idx: 50, Val: "realtime"}, {Idx: 40, Val: "high"}, {Idx: 30, Val: "medium"}, {Idx: 20, Val: "low"}, {Idx: 10, Val: "idle"}},
	}
)

Functions

func GetJobDbFieldsAsStrings

func GetJobDbFieldsAsStrings() []string

func IsValidJobStatus

func IsValidJobStatus(statusVal string) bool

func IsValidPriority

func IsValidPriority(prio string) bool

Types

type Job

type Job struct {
	Id            ksuid.KSUID `db:"id"`
	CorrelationId string      `db:"correlation_id"`
	Name          string      `db:"name"`
	CreatedAt     time.Time   `db:"created_at"`
	CreatedBy     string      `db:"created_by"`
	ModifiedAt    time.Time   `db:"modified_at"`
	ModifiedBy    string      `db:"modified_by"`
	Status        JobStatus   `db:"status"`
	Source        string      `db:"source"`
	Destination   string      `db:"destination"`
	Type          string      `db:"type"`
	SubType       string      `db:"sub_type"`
	Action        string      `db:"action"`
	ActionDetails string      `db:"action_details"`
	Progress      int32       `db:"progress"`
	History       string      `db:"history"`
	ExtraData     string      `db:"extra_data"`
	Priority      int32       `db:"priority"`
	Rank          int32       `db:"rank"`
}

func NewJob

func NewJob(jobName string, jobType string) (*Job, api_error.ApiErr)

func NewJobFromJobRequestDto

func NewJobFromJobRequestDto(jobReq dto.CreateUpdateJobRequest) (*Job, api_error.ApiErr)

func (*Job) AddHistory

func (j *Job) AddHistory(msg string)

func (*Job) ToJobResponseDto

func (j *Job) ToJobResponseDto() dto.JobResponse

type JobRepository

type JobRepository interface {
	Store(Job) api_error.ApiErr
	FindAll(dto.SortAndFilterRequest) (*[]Job, int, api_error.ApiErr)
	FindById(string) (*Job, api_error.ApiErr)
	Update(string, dto.CreateUpdateJobRequest) (*Job, api_error.ApiErr)
	DeleteById(string) api_error.ApiErr
	Dequeue(string) (*Job, api_error.ApiErr)
	SetStatusById(string, string, string) api_error.ApiErr
	SetHistoryById(string, string) api_error.ApiErr
	DeleteAllJobs() api_error.ApiErr
}

type JobStatus

type JobStatus string
const (
	StatusCreated  JobStatus = "created"
	StatusQueued   JobStatus = "queued"
	StatusRunning  JobStatus = "running"
	StatusPaused   JobStatus = "paused"
	StatusFinished JobStatus = "finished"
	StatusFailed   JobStatus = "failed"
)

Jump to

Keyboard shortcuts

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