Documentation
¶
Overview ¶
Package app exposes shared services for manipulating bujo entries and collections.
Index ¶
- Variables
- type MigrationCandidate
- type ReportItem
- type ReportResult
- type ReportSection
- type Service
- func (s *Service) Add(_ context.Context, collection string, b glyph.Bullet, msg string, ...) (*entry.Entry, error)
- func (s *Service) AddDependsOn(ctx context.Context, id string, dependsOn []string) (*entry.Entry, error)
- func (s *Service) AddLabels(ctx context.Context, id string, labels []string) (*entry.Entry, error)
- func (s *Service) ClearDependsOn(ctx context.Context, id string) (*entry.Entry, error)
- func (s *Service) ClearLabels(ctx context.Context, id string) (*entry.Entry, error)
- func (s *Service) Collections(ctx context.Context) ([]string, error)
- func (s *Service) CollectionsMeta(ctx context.Context, prefix string) ([]collection.Meta, error)
- func (s *Service) Complete(ctx context.Context, id string) (*entry.Entry, error)
- func (s *Service) Delete(ctx context.Context, id string) error
- func (s *Service) DeleteCollection(ctx context.Context, collectionName string) error
- func (s *Service) Edit(ctx context.Context, id string, newMsg string) (*entry.Entry, error)
- func (s *Service) EnsureCollection(ctx context.Context, collection string) error
- func (s *Service) EnsureCollectionOfType(ctx context.Context, collectionName string, typ collection.Type) error
- func (s *Service) EnsureCollections(ctx context.Context, collections []string) error
- func (s *Service) Entries(ctx context.Context, collection string) ([]*entry.Entry, error)
- func (s *Service) Lock(ctx context.Context, id string) (*entry.Entry, error)
- func (s *Service) MigrationCandidates(ctx context.Context, since, until time.Time) ([]MigrationCandidate, error)
- func (s *Service) Move(ctx context.Context, id string, target string) (*entry.Entry, error)
- func (s *Service) RemoveDependsOn(ctx context.Context, id string, dependsOn []string) (*entry.Entry, error)
- func (s *Service) RemoveLabels(ctx context.Context, id string, labels []string) (*entry.Entry, error)
- func (s *Service) Report(ctx context.Context, since, until time.Time) (ReportResult, error)
- func (s *Service) SetBullet(ctx context.Context, id string, b glyph.Bullet) (*entry.Entry, error)
- func (s *Service) SetCollectionType(ctx context.Context, collectionName string, typ collection.Type) error
- func (s *Service) SetDependsOn(ctx context.Context, id string, dependsOn []string) (*entry.Entry, error)
- func (s *Service) SetLabels(ctx context.Context, id string, labels []string) (*entry.Entry, error)
- func (s *Service) SetParent(ctx context.Context, id, parentID string) (*entry.Entry, error)
- func (s *Service) SetSignifier(ctx context.Context, id string, sig glyph.Signifier) (*entry.Entry, error)
- func (s *Service) Strike(ctx context.Context, id string) (*entry.Entry, error)
- func (s *Service) ToggleSignifier(ctx context.Context, id string, sig glyph.Signifier) (*entry.Entry, error)
- func (s *Service) Unlock(ctx context.Context, id string) (*entry.Entry, error)
- func (s *Service) Watch(ctx context.Context) (<-chan store.Event, error)
Constants ¶
This section is empty.
Variables ¶
var ErrImmutable = errors.New("app: entry is immutable")
ErrImmutable indicates operations on an immutable entry are not allowed.
var ErrInvalidCollection = errors.New("app: invalid collection")
ErrInvalidCollection indicates a collection path or segment was invalid.
Functions ¶
This section is empty.
Types ¶
type MigrationCandidate ¶
MigrationCandidate represents an open task that needs attention during a migration session.
type ReportItem ¶
ReportItem captures a completed entry and the timestamp it was completed.
type ReportResult ¶
ReportResult encapsulates a completed-entries report for a time window.
type ReportSection ¶
type ReportSection struct {
Collection string
Entries []ReportItem
}
ReportSection groups completed entries by collection.
type Service ¶
type Service struct {
Persistence store.Persistence
}
Service provides high-level operations for entries and collections. It wraps persistence and entry transformations so UIs and CLIs can share logic.
func (*Service) Add ¶
func (s *Service) Add(_ context.Context, collection string, b glyph.Bullet, msg string, sig glyph.Signifier) (*entry.Entry, error)
Add creates and stores a new entry.
func (*Service) AddDependsOn ¶
func (s *Service) AddDependsOn(ctx context.Context, id string, dependsOn []string) (*entry.Entry, error)
AddDependsOn merges dependency IDs into the entry.
func (*Service) ClearDependsOn ¶
ClearDependsOn removes all dependencies from the entry.
func (*Service) ClearLabels ¶
ClearLabels removes all labels from the entry.
func (*Service) Collections ¶
Collections returns sorted collection names.
func (*Service) CollectionsMeta ¶
CollectionsMeta returns collection metadata filtered by prefix.
func (*Service) DeleteCollection ¶
DeleteCollection removes a collection and its descendants.
func (*Service) EnsureCollection ¶
EnsureCollection ensures the named collection exists even if empty.
func (*Service) EnsureCollectionOfType ¶
func (s *Service) EnsureCollectionOfType(ctx context.Context, collectionName string, typ collection.Type) error
EnsureCollectionOfType ensures the collection exists and records its type.
func (*Service) EnsureCollections ¶
EnsureCollections ensures each collection in the slice exists.
func (*Service) MigrationCandidates ¶
func (s *Service) MigrationCandidates(ctx context.Context, since, until time.Time) ([]MigrationCandidate, error)
MigrationCandidates returns open, completable entries that require review in a migration session. When the since window is zero, all open tasks/events outside the Future tree (and not scheduled on future daily collections) are returned alongside top-level Future entries. When a non-zero window is provided, candidates must have been touched within the window, with top-level Future entries always included. LastTouched reflects the most recent history record (or creation time).
func (*Service) Move ¶
Move clones an entry into the target collection and marks the original as moved.
func (*Service) RemoveDependsOn ¶
func (s *Service) RemoveDependsOn(ctx context.Context, id string, dependsOn []string) (*entry.Entry, error)
RemoveDependsOn removes dependency IDs from the entry.
func (*Service) RemoveLabels ¶
func (s *Service) RemoveLabels(ctx context.Context, id string, labels []string) (*entry.Entry, error)
RemoveLabels removes labels from the entry.
func (*Service) Report ¶
Report returns completed entries grouped by collection between the provided bounds.
func (*Service) SetCollectionType ¶
func (s *Service) SetCollectionType(ctx context.Context, collectionName string, typ collection.Type) error
SetCollectionType updates metadata for an existing collection.
func (*Service) SetDependsOn ¶
func (s *Service) SetDependsOn(ctx context.Context, id string, dependsOn []string) (*entry.Entry, error)
SetDependsOn replaces dependency IDs with the provided canonicalized set.
func (*Service) SetLabels ¶
SetLabels replaces the entry labels with the provided canonicalized set.
func (*Service) SetParent ¶
SetParent reassigns the parent relationship for an entry within a collection.
func (*Service) SetSignifier ¶
func (s *Service) SetSignifier(ctx context.Context, id string, sig glyph.Signifier) (*entry.Entry, error)
SetSignifier assigns the provided signifier to the entry id.
func (*Service) ToggleSignifier ¶
func (s *Service) ToggleSignifier(ctx context.Context, id string, sig glyph.Signifier) (*entry.Entry, error)
ToggleSignifier toggles a given signifier on/off for the entry id. If the same signifier is set, it clears it; otherwise it sets it.