v0.29.0 21b3150

history.go RawHistoryFolder

1package repository
2
3import (
4	"context"
5	"time"
6
7	"github.com/bnema/dumber/internal/domain/entity"
8)
9
10// HistoryRepository defines operations for browsing history persistence.
11type HistoryRepository interface {
12	// Save creates or updates a history entry (upsert).
13	Save(ctx context.Context, entry *entity.HistoryEntry) error
14
15	// FindByURL retrieves a history entry by its URL.
16	FindByURL(ctx context.Context, url string) (*entity.HistoryEntry, error)
17
18	// Search performs a fuzzy search on history entries.
19	Search(ctx context.Context, query string, limit int) ([]entity.HistoryMatch, error)
20
21	// GetRecent retrieves recent history entries with pagination. A zero limit means all entries.
22	GetRecent(ctx context.Context, limit, offset int) ([]*entity.HistoryEntry, error)
23
24	// GetRecentByDomain retrieves recent history entries for a domain with pagination. A zero limit means all matching entries.
25	GetRecentByDomain(ctx context.Context, domain string, limit, offset int) ([]*entity.HistoryEntry, error)
26
27	// GetRecentWindow retrieves entries visited in [after, before), sorted by recency.
28	GetRecentWindow(ctx context.Context, before, after time.Time) ([]*entity.HistoryEntry, error)
29
30	// GetRecentWindowByDomain retrieves domain entries visited in [after, before), sorted by recency.
31	GetRecentWindowByDomain(ctx context.Context, domain string, before, after time.Time) ([]*entity.HistoryEntry, error)
32
33	// HasEntriesBefore reports whether any history entry was visited before the given time.
34	HasEntriesBefore(ctx context.Context, before time.Time) (bool, error)
35
36	// HasEntriesByDomainBefore reports whether any domain entry was visited before the given time.
37	HasEntriesByDomainBefore(ctx context.Context, domain string, before time.Time) (bool, error)
38
39	// GetRecentSince retrieves history entries visited within the last N days.
40	// days must be > 0.
41	GetRecentSince(ctx context.Context, days int) ([]*entity.HistoryEntry, error)
42
43	// GetMostVisited retrieves history entries sorted by visit count within the last N days.
44	// days must be > 0.
45	GetMostVisited(ctx context.Context, days int) ([]*entity.HistoryEntry, error)
46
47	// GetAllRecentHistory retrieves all history entries sorted by recency.
48	GetAllRecentHistory(ctx context.Context) ([]*entity.HistoryEntry, error)
49
50	// GetAllMostVisited retrieves all history entries sorted by visit count.
51	GetAllMostVisited(ctx context.Context) ([]*entity.HistoryEntry, error)
52
53	// IncrementVisitCount increments the visit count for a URL.
54	IncrementVisitCount(ctx context.Context, url string) error
55
56	// Delete removes a single history entry by ID.
57	Delete(ctx context.Context, id int64) error
58
59	// DeleteOlderThan removes entries older than the given time.
60	DeleteOlderThan(ctx context.Context, before time.Time) error
61
62	// DeleteSince removes entries visited at or after the given time.
63	DeleteSince(ctx context.Context, since time.Time) error
64
65	// DeleteAll removes all history entries.
66	DeleteAll(ctx context.Context) error
67
68	// DeleteByDomain removes all history entries for a domain.
69	DeleteByDomain(ctx context.Context, domain string) error
70
71	// GetStats retrieves overall history statistics.
72	GetStats(ctx context.Context) (*entity.HistoryStats, error)
73
74	// GetDomainStats retrieves per-domain statistics.
75	GetDomainStats(ctx context.Context, limit int) ([]*entity.DomainStat, error)
76
77	// GetHourlyDistribution retrieves hourly visit distribution.
78	GetHourlyDistribution(ctx context.Context) ([]*entity.HourlyDistribution, error)
79
80	// GetDailyVisitCount retrieves daily visit counts for the given period.
81	GetDailyVisitCount(ctx context.Context, daysAgo string) ([]*entity.DailyVisitCount, error)
82}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close