v0.23.3 fc8669a

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.
22	GetRecent(ctx context.Context, limit, offset int) ([]*entity.HistoryEntry, error)
23
24	// GetRecentSince retrieves history entries visited within the last N days.
25	// days must be > 0.
26	GetRecentSince(ctx context.Context, days int) ([]*entity.HistoryEntry, error)
27
28	// GetMostVisited retrieves history entries sorted by visit count within the last N days.
29	// days must be > 0.
30	GetMostVisited(ctx context.Context, days int) ([]*entity.HistoryEntry, error)
31
32	// GetAllRecentHistory retrieves all history entries sorted by recency.
33	GetAllRecentHistory(ctx context.Context) ([]*entity.HistoryEntry, error)
34
35	// GetAllMostVisited retrieves all history entries sorted by visit count.
36	GetAllMostVisited(ctx context.Context) ([]*entity.HistoryEntry, error)
37
38	// IncrementVisitCount increments the visit count for a URL.
39	IncrementVisitCount(ctx context.Context, url string) error
40
41	// Delete removes a single history entry by ID.
42	Delete(ctx context.Context, id int64) error
43
44	// DeleteOlderThan removes entries older than the given time.
45	DeleteOlderThan(ctx context.Context, before time.Time) error
46
47	// DeleteAll removes all history entries.
48	DeleteAll(ctx context.Context) error
49
50	// DeleteByDomain removes all history entries for a domain.
51	DeleteByDomain(ctx context.Context, domain string) error
52
53	// GetStats retrieves overall history statistics.
54	GetStats(ctx context.Context) (*entity.HistoryStats, error)
55
56	// GetDomainStats retrieves per-domain statistics.
57	GetDomainStats(ctx context.Context, limit int) ([]*entity.DomainStat, error)
58
59	// GetHourlyDistribution retrieves hourly visit distribution.
60	GetHourlyDistribution(ctx context.Context) ([]*entity.HourlyDistribution, error)
61
62	// GetDailyVisitCount retrieves daily visit counts for the given period.
63	GetDailyVisitCount(ctx context.Context, daysAgo string) ([]*entity.DailyVisitCount, error)
64}

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