Documentation
¶
Index ¶
- Variables
- type Store
- type Task
- type TaskStatus
- type TaskStore
- func (s *TaskStore) AddDependency(taskID, blockedByID string) error
- func (s *TaskStore) Close() error
- func (s *TaskStore) Create(subject, description, activeForm string) (*Task, error)
- func (s *TaskStore) Delete(id string) error
- func (s *TaskStore) Get(id string) (*Task, error)
- func (s *TaskStore) GetBlockedTasks(taskID string) []*Task
- func (s *TaskStore) GetBlockingTasks(taskID string) []*Task
- func (s *TaskStore) List() []*Task
- func (s *TaskStore) RemoveDependency(taskID, blockedByID string) error
- func (s *TaskStore) Snapshot() []*Task
- func (s *TaskStore) Update(id string, updates TaskUpdate) (*Task, error)
- type TaskUpdate
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrSelfDependency = errors.New("tasks: task cannot depend on itself") ErrDependencyCycle = errors.New("tasks: dependency cycle detected") )
View Source
var ( ErrEmptySubject = errors.New("tasks: subject is required") ErrInvalidTaskID = errors.New("tasks: invalid task id") ErrTaskNotFound = errors.New("tasks: task not found") ErrInvalidTaskStatus = errors.New("tasks: invalid task status") ErrTaskBlocked = errors.New("tasks: task is blocked by incomplete dependencies") )
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store interface {
Create(subject, description, activeForm string) (*Task, error)
Get(id string) (*Task, error)
Update(id string, updates TaskUpdate) (*Task, error)
List() []*Task
Snapshot() []*Task
Delete(id string) error
AddDependency(taskID, blockedByID string) error
RemoveDependency(taskID, blockedByID string) error
GetBlockedTasks(taskID string) []*Task
GetBlockingTasks(taskID string) []*Task
Close() error
}
Store defines the task storage contract used by builtin task tools. The interface enables dependency injection of external persistent store implementations (e.g., database-backed) beyond the default in-memory store.
type Task ¶
type Task struct {
ID string `json:"id"`
Subject string `json:"subject"`
Description string `json:"description"`
ActiveForm string `json:"activeForm"`
Status TaskStatus `json:"status"`
Owner string `json:"owner"`
Blocks []string `json:"blocks"`
BlockedBy []string `json:"blockedBy"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
type TaskStatus ¶
type TaskStatus string
const ( TaskPending TaskStatus = "pending" TaskInProgress TaskStatus = "in_progress" TaskCompleted TaskStatus = "completed" TaskBlocked TaskStatus = "blocked" )
type TaskStore ¶
type TaskStore struct {
// contains filtered or unexported fields
}
func NewTaskStore ¶
func NewTaskStore() *TaskStore
func NewTaskStoreFromSnapshot ¶
NewTaskStoreFromSnapshot creates a store from an external snapshot. Invalid entries (empty IDs) are skipped.
func (*TaskStore) AddDependency ¶
func (*TaskStore) Close ¶
Close is a no-op for the in-memory implementation. It exists in the Store interface so that persistent implementations can release resources (e.g., close database connections) on shutdown.
func (*TaskStore) GetBlockedTasks ¶
func (*TaskStore) GetBlockingTasks ¶
func (*TaskStore) RemoveDependency ¶
type TaskUpdate ¶
type TaskUpdate struct {
Subject *string
Description *string
ActiveForm *string
Status *TaskStatus
Owner *string
}
Click to show internal directories.
Click to hide internal directories.