v0.20.0 c741a39

favorite.go RawHistoryFolder

1package repository
2
3import (
4	"context"
5
6	"github.com/bnema/dumber/internal/domain/entity"
7)
8
9// FavoriteRepository defines operations for bookmark persistence.
10type FavoriteRepository interface {
11	// Save creates or updates a favorite.
12	Save(ctx context.Context, fav *entity.Favorite) error
13
14	// FindByID retrieves a favorite by its ID.
15	FindByID(ctx context.Context, id entity.FavoriteID) (*entity.Favorite, error)
16
17	// FindByURL retrieves a favorite by its URL.
18	FindByURL(ctx context.Context, url string) (*entity.Favorite, error)
19
20	// GetAll retrieves all favorites.
21	GetAll(ctx context.Context) ([]*entity.Favorite, error)
22
23	// GetByFolder retrieves favorites in a specific folder.
24	// Pass nil for root-level favorites.
25	GetByFolder(ctx context.Context, folderID *entity.FolderID) ([]*entity.Favorite, error)
26
27	// GetByShortcut retrieves the favorite with the given shortcut key (1-9).
28	GetByShortcut(ctx context.Context, key int) (*entity.Favorite, error)
29
30	// UpdatePosition updates a favorite's position within its folder.
31	UpdatePosition(ctx context.Context, id entity.FavoriteID, position int) error
32
33	// SetFolder moves a favorite to a different folder.
34	SetFolder(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID) error
35
36	// SetShortcut assigns a keyboard shortcut (1-9) or nil to remove.
37	SetShortcut(ctx context.Context, id entity.FavoriteID, key *int) error
38
39	// Delete removes a favorite by ID.
40	Delete(ctx context.Context, id entity.FavoriteID) error
41}
42
43// FolderRepository defines operations for bookmark folder persistence.
44type FolderRepository interface {
45	// Save creates or updates a folder.
46	Save(ctx context.Context, folder *entity.Folder) error
47
48	// FindByID retrieves a folder by its ID.
49	FindByID(ctx context.Context, id entity.FolderID) (*entity.Folder, error)
50
51	// GetAll retrieves all folders.
52	GetAll(ctx context.Context) ([]*entity.Folder, error)
53
54	// GetChildren retrieves child folders of a parent.
55	// Pass nil for root-level folders.
56	GetChildren(ctx context.Context, parentID *entity.FolderID) ([]*entity.Folder, error)
57
58	// UpdatePosition updates a folder's position within its parent.
59	UpdatePosition(ctx context.Context, id entity.FolderID, position int) error
60
61	// Delete removes a folder by ID.
62	// Favorites in the folder should be moved to root.
63	Delete(ctx context.Context, id entity.FolderID) error
64}
65
66// TagRepository defines operations for tag persistence.
67type TagRepository interface {
68	// Save creates or updates a tag.
69	Save(ctx context.Context, tag *entity.Tag) error
70
71	// FindByID retrieves a tag by its ID.
72	FindByID(ctx context.Context, id entity.TagID) (*entity.Tag, error)
73
74	// FindByName retrieves a tag by its name.
75	FindByName(ctx context.Context, name string) (*entity.Tag, error)
76
77	// GetAll retrieves all tags.
78	GetAll(ctx context.Context) ([]*entity.Tag, error)
79
80	// AssignToFavorite associates a tag with a favorite.
81	AssignToFavorite(ctx context.Context, tagID entity.TagID, favID entity.FavoriteID) error
82
83	// RemoveFromFavorite removes a tag association from a favorite.
84	RemoveFromFavorite(ctx context.Context, tagID entity.TagID, favID entity.FavoriteID) error
85
86	// GetForFavorite retrieves all tags associated with a favorite.
87	GetForFavorite(ctx context.Context, favID entity.FavoriteID) ([]*entity.Tag, error)
88
89	// Delete removes a tag by ID.
90	Delete(ctx context.Context, id entity.TagID) error
91}

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