feat: 🎉 postgresql broker first commit of forked prototype from my original code
This commit is contained in:
73
pkg/broker/models/models.go
Normal file
73
pkg/broker/models/models.go
Normal file
@@ -0,0 +1,73 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
// Job represents a broker job
|
||||
type Job struct {
|
||||
ID int64 `json:"id"`
|
||||
JobName string `json:"job_name"`
|
||||
JobPriority int32 `json:"job_priority"`
|
||||
JobQueue int `json:"job_queue"`
|
||||
JobLanguage string `json:"job_language"`
|
||||
ExecuteStr string `json:"execute_str"`
|
||||
ExecuteResult string `json:"execute_result"`
|
||||
ErrorMsg string `json:"error_msg"`
|
||||
CompleteStatus int `json:"complete_status"`
|
||||
RunAs string `json:"run_as"`
|
||||
UserLogin string `json:"user_login"`
|
||||
ScheduleID int64 `json:"schedule_id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// Instance represents a broker instance
|
||||
type Instance struct {
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Hostname string `json:"hostname"`
|
||||
PID int `json:"pid"`
|
||||
Version string `json:"version"`
|
||||
Status string `json:"status"` // active, inactive, shutdown
|
||||
StartedAt time.Time `json:"started_at"`
|
||||
LastPingAt time.Time `json:"last_ping_at"`
|
||||
ShutdownAt time.Time `json:"shutdown_at"`
|
||||
QueueCount int `json:"queue_count"`
|
||||
JobsHandled int64 `json:"jobs_handled"`
|
||||
}
|
||||
|
||||
// Schedule represents a job schedule
|
||||
type Schedule struct {
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
CronExpr string `json:"cron_expr"`
|
||||
Enabled bool `json:"enabled"`
|
||||
JobName string `json:"job_name"`
|
||||
JobPriority int32 `json:"job_priority"`
|
||||
JobQueue int `json:"job_queue"`
|
||||
ExecuteStr string `json:"execute_str"`
|
||||
RunAs string `json:"run_as"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
LastRunAt time.Time `json:"last_run_at"`
|
||||
NextRunAt time.Time `json:"next_run_at"`
|
||||
}
|
||||
|
||||
// JobStatus represents job completion statuses
|
||||
type JobStatus int
|
||||
|
||||
const (
|
||||
JobStatusPending JobStatus = 0
|
||||
JobStatusRunning JobStatus = 1
|
||||
JobStatusCompleted JobStatus = 2
|
||||
JobStatusFailed JobStatus = 3
|
||||
JobStatusCancelled JobStatus = 4
|
||||
)
|
||||
|
||||
// InstanceStatus represents instance statuses
|
||||
type InstanceStatus string
|
||||
|
||||
const (
|
||||
InstanceStatusActive InstanceStatus = "active"
|
||||
InstanceStatusInactive InstanceStatus = "inactive"
|
||||
InstanceStatusShutdown InstanceStatus = "shutdown"
|
||||
)
|
||||
Reference in New Issue
Block a user