Documentation
¶
Index ¶
- Variables
- type DB
- func (d *DB) Close() error
- func (d *DB) CompleteProject(ctx context.Context, id int64, cascade bool, at time.Time) (gtd.Project, error)
- func (d *DB) CompleteTask(ctx context.Context, id int64, at time.Time) (gtd.Task, error)
- func (d *DB) CountTasksByProjects(ctx context.Context, projectIDs []int64) (map[int64]gtd.ProjectTaskCounts, error)
- func (d *DB) CreateItem(ctx context.Context, item gtd.Item) (gtd.Item, error)
- func (d *DB) CreateProject(ctx context.Context, project gtd.Project) (gtd.Project, error)
- func (d *DB) CreateTask(ctx context.Context, task gtd.Task) (gtd.Task, error)
- func (d *DB) DeleteTask(ctx context.Context, id int64) error
- func (d *DB) DropProject(ctx context.Context, id int64, cascade bool, at time.Time) (gtd.Project, error)
- func (d *DB) DropTask(ctx context.Context, id int64, at time.Time) (gtd.Task, error)
- func (d *DB) GetItem(ctx context.Context, id int64) (gtd.Item, error)
- func (d *DB) GetProject(ctx context.Context, id int64) (gtd.Project, error)
- func (d *DB) GetTask(ctx context.Context, id int64) (gtd.Task, error)
- func (d *DB) ListItems(ctx context.Context) ([]gtd.Item, error)
- func (d *DB) ListProjects(ctx context.Context, filter gtd.ProjectFilter) ([]gtd.Project, error)
- func (d *DB) ListTasks(ctx context.Context, filter gtd.TaskFilter) ([]gtd.Task, error)
- func (d *DB) MoveProjectDown(ctx context.Context, id int64, filter gtd.ProjectFilter) error
- func (d *DB) MoveProjectUp(ctx context.Context, id int64, filter gtd.ProjectFilter) error
- func (d *DB) MoveTaskDown(ctx context.Context, id int64, filter gtd.TaskFilter) error
- func (d *DB) MoveTaskUp(ctx context.Context, id int64, filter gtd.TaskFilter) error
- func (d *DB) ParkProject(ctx context.Context, id int64, at time.Time) (gtd.Project, error)
- func (d *DB) ReopenProject(ctx context.Context, id int64, at time.Time) (gtd.Project, error)
- func (d *DB) ReopenTask(ctx context.Context, id int64, at time.Time) (gtd.Task, error)
- func (d *DB) RunTx(ctx context.Context, f func(context.Context, *DB) error) (err error)
- func (d *DB) UpdateItemClarifiedIntoProject(ctx context.Context, id, projectID int64) (gtd.Item, error)
- func (d *DB) UpdateItemClarifiedIntoTask(ctx context.Context, id, taskID int64) (gtd.Item, error)
- func (d *DB) UpdateItemDiscarded(ctx context.Context, id int64) (gtd.Item, error)
- func (d *DB) UpdateProject(ctx context.Context, project gtd.Project) (gtd.Project, error)
- func (d *DB) UpdateTask(ctx context.Context, task gtd.Task) (gtd.Task, error)
- type QueryContext
Constants ¶
This section is empty.
Variables ¶
var (
ErrAlreadyInTx = errors.New("already in transaction")
)
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB wraps a SQLite database connection.
func Open ¶
Open opens the SQLite database at the given path, creating it if necessary, and runs any pending migrations.
func (*DB) CompleteProject ¶
func (*DB) CompleteTask ¶
func (*DB) CountTasksByProjects ¶
func (*DB) CreateItem ¶
CreateItem inserts a fresh inbox capture. Clarify pointers and the discarded flag are not accepted on create — items start in the inbox unconditionally and reach terminal state only via the service-layer clarify operations.
func (*DB) CreateProject ¶
func (*DB) CreateTask ¶
func (*DB) DropProject ¶
func (*DB) ListItems ¶
ListItems returns inbox items that have not been clarified or discarded, ordered by created_at ASC (FIFO).
func (*DB) ListProjects ¶
func (*DB) MoveProjectDown ¶
MoveProjectDown shifts the project one slot later within projects of the same status that match filter. No-op when already at the bottom of the filtered set.
func (*DB) MoveProjectUp ¶
MoveProjectUp shifts the project one slot earlier within projects of the same status that match filter. No-op when already at the top of the filtered set.
func (*DB) MoveTaskDown ¶
MoveTaskDown shifts the task one slot later within the open tasks matching filter. No-op when already at the bottom of the filtered set.
func (*DB) MoveTaskUp ¶
MoveTaskUp shifts the task one slot earlier within the open tasks matching filter. No-op when already at the top of the filtered set.
func (*DB) ParkProject ¶
func (*DB) ReopenProject ¶
func (*DB) ReopenTask ¶
func (*DB) UpdateItemClarifiedIntoProject ¶
func (d *DB) UpdateItemClarifiedIntoProject(ctx context.Context, id, projectID int64) (gtd.Item, error)
UpdateItemClarifiedIntoProject stamps the item's ClarifiedIntoProjectID (used by both Incubate and ClarifyAsProject) and returns the resulting row.
func (*DB) UpdateItemClarifiedIntoTask ¶
UpdateItemClarifiedIntoTask stamps the item's ClarifiedIntoTaskID and returns the resulting row. The caller is responsible for transaction wrapping and pre-checks; the underlying CHECK constraint enforces mutual exclusion as a safety net.
func (*DB) UpdateItemDiscarded ¶
UpdateItemDiscarded marks an item as discarded and returns the resulting row.