Documentation
¶
Index ¶
- type JSONMap
- type Service
- func (s *Service) CreateTask(ctx context.Context, task *Task) error
- func (s *Service) DeleteTask(ctx context.Context, userID string, taskID uint) error
- func (s *Service) GetTask(ctx context.Context, userID string, taskID uint) (*Task, error)
- func (s *Service) ListTasks(ctx context.Context, userID string) ([]*Task, error)
- func (s *Service) SetDB(db *gorm.DB)
- func (s *Service) UpdateTaskStatus(ctx context.Context, userID string, taskID uint, status TaskStatus) error
- type Task
- type TaskStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONMap ¶
type JSONMap map[string]interface{}
JSONMap is a custom type for handling JSON maps in GORM
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides task orchestration functionality
func (*Service) CreateTask ¶
CreateTask creates a new task
func (*Service) DeleteTask ¶
DeleteTask deletes a task
func (*Service) UpdateTaskStatus ¶
func (s *Service) UpdateTaskStatus(ctx context.Context, userID string, taskID uint, status TaskStatus) error
UpdateTaskStatus updates the status of a task
type Task ¶
type Task struct {
ID uint `json:"id" gorm:"primaryKey"`
Name string `json:"name" gorm:"not null"`
Description string `json:"description"`
Type string `json:"type" gorm:"not null"`
UserID string `json:"user_id" gorm:"index;not null"`
Status TaskStatus `json:"status" gorm:"default:0"`
Priority int `json:"priority" gorm:"default:0"`
Config JSONMap `json:"config" gorm:"type:text"`
Result JSONMap `json:"result" gorm:"type:text"`
Error string `json:"error"`
ScheduledAt *time.Time `json:"scheduled_at"`
StartedAt *time.Time `json:"started_at"`
CompletedAt *time.Time `json:"completed_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
}
Task represents a task in the system
type TaskStatus ¶
type TaskStatus int
TaskStatus represents the status of a task
const ( TaskStatusPending TaskStatus = iota TaskStatusRunning TaskStatusCompleted TaskStatusFailed TaskStatusCancelled )
func (TaskStatus) String ¶
func (t TaskStatus) String() string
String returns the string representation of TaskStatus
Click to show internal directories.
Click to hide internal directories.