Documentation
¶
Overview ¶
Package entry defines the core bullet journal entry model.
Index ¶
- Constants
- func FormatTime(v time.Time) string
- func NormalizeDependsOnIDs(ids []string) []string
- func NormalizeLabels(labels []string) []string
- func ParseTime(v string) (time.Time, error)
- type Entry
- func (e *Entry) AddDependsOn(ids []string)
- func (e *Entry) AddLabels(labels []string)
- func (e *Entry) CloneToCollection(collection string) *Entry
- func (e *Entry) Complete()
- func (e *Entry) EnsureHistorySeed()
- func (e *Entry) LastCompletionTime() (time.Time, bool)
- func (e *Entry) Lock()
- func (e *Entry) Move(bullet glyph.Bullet, collection string) *Entry
- func (e *Entry) NormalizeDependsOn()
- func (e *Entry) NormalizeLabels()
- func (e *Entry) RemoveDependsOn(ids []string)
- func (e *Entry) RemoveLabels(labels []string)
- func (e *Entry) SetDependsOn(ids []string)
- func (e *Entry) SetLabels(labels []string)
- func (e *Entry) Strike()
- func (e *Entry) String() string
- func (e *Entry) Title() string
- func (e *Entry) Unlock()
- type HistoryAction
- type HistoryRecord
- type Timestamp
Constants ¶
const (
CurrentSchema = "v1"
)
CurrentSchema identifies the persisted entry schema version.
Variables ¶
This section is empty.
Functions ¶
func NormalizeDependsOnIDs ¶
NormalizeDependsOnIDs returns canonical depends_on IDs: trim/dedupe/sort.
func NormalizeLabels ¶
NormalizeLabels returns canonical labels: trim/lowercase/dedupe/sort.
Types ¶
type Entry ¶
type Entry struct {
ID string `json:"-"` // do not json. ID is the filename.
Bullet glyph.Bullet `json:"bullet"`
Schema string `json:"schema"`
Created Timestamp `json:"created"`
Collection string `json:"collection"`
On *Timestamp `json:"on,omitempty"`
Signifier glyph.Signifier `json:"signifier,omitempty"`
Message string `json:"message,omitempty"`
Labels []string `json:"labels,omitempty"`
DependsOn []string `json:"depends_on,omitempty"`
ParentID string `json:"parent_id,omitempty"`
Immutable bool `json:"immutable,omitempty"`
History []HistoryRecord `json:"history,omitempty"`
}
Entry represents a single bullet journal entry.
func (*Entry) AddDependsOn ¶
AddDependsOn merges dependency IDs into the current canonicalized set.
func (*Entry) CloneToCollection ¶
CloneToCollection creates a deep copy destined for the provided collection while preserving bullet, signifier, message, and parent linkage.
func (*Entry) EnsureHistorySeed ¶
func (e *Entry) EnsureHistorySeed()
EnsureHistorySeed populates a default history record for legacy entries that predate the history field.
func (*Entry) LastCompletionTime ¶
LastCompletionTime reports the most recent timestamp the entry was completed.
func (*Entry) NormalizeDependsOn ¶
func (e *Entry) NormalizeDependsOn()
NormalizeDependsOn canonicalizes depends_on IDs in place: trim/dedupe/sort.
func (*Entry) NormalizeLabels ¶
func (e *Entry) NormalizeLabels()
NormalizeLabels canonicalizes labels in place: trim/lowercase/dedupe/sort.
func (*Entry) RemoveDependsOn ¶
RemoveDependsOn removes matching dependency IDs from the canonicalized set.
func (*Entry) RemoveLabels ¶
RemoveLabels removes matching labels from the canonicalized set.
func (*Entry) SetDependsOn ¶
SetDependsOn replaces dependency IDs with the canonicalized input.
type HistoryAction ¶
type HistoryAction string
HistoryAction describes a recorded change in an entry's history.
const ( // HistoryActionAdded indicates the entry was created. HistoryActionAdded HistoryAction = "added" // HistoryActionMoved indicates the entry was migrated to another collection. HistoryActionMoved HistoryAction = "moved" // HistoryActionCompleted indicates the entry was completed. HistoryActionCompleted HistoryAction = "completed" // HistoryActionStruck indicates the entry was struck out as irrelevant. HistoryActionStruck HistoryAction = "struck" )
type HistoryRecord ¶
type HistoryRecord struct {
Timestamp Timestamp `json:"timestamp"`
Action HistoryAction `json:"action"`
From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
}
HistoryRecord captures a single history event for an entry.
type Timestamp ¶
Timestamp wraps time.Time with helper methods for journaling logic.
func (*Timestamp) MarshalJSON ¶
MarshalJSON serializes the timestamp into RFC3339 JSON.
func (Timestamp) SameDay ¶
SameDay reports whether the timestamp falls on the same local day as then.
func (Timestamp) SameMonth ¶
SameMonth reports whether the timestamp falls in the same month/year as then.
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON parses a timestamp from its JSON encoding.