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	// GetByTag retrieves favorites with a specific tag.
24	GetByTag(ctx context.Context, tagID entity.TagID) ([]*entity.Favorite, error)
25
26	// GetByShortcut retrieves the favorite with the given shortcut key (1-9).
27	GetByShortcut(ctx context.Context, key int) (*entity.Favorite, error)
28
29	// UpdatePosition updates a favorite's position.
30	UpdatePosition(ctx context.Context, id entity.FavoriteID, position int) error
31
32	// SetShortcut assigns a keyboard shortcut (1-9) or nil to remove.
33	SetShortcut(ctx context.Context, id entity.FavoriteID, key *int) error
34
35	// Delete removes a favorite by ID.
36	Delete(ctx context.Context, id entity.FavoriteID) error
37}
38
39// TagRepository defines operations for tag persistence.
40type TagRepository interface {
41	// Save creates or updates a tag.
42	Save(ctx context.Context, tag *entity.Tag) error
43
44	// FindByID retrieves a tag by its ID.
45	FindByID(ctx context.Context, id entity.TagID) (*entity.Tag, error)
46
47	// FindByName retrieves a tag by its name.
48	FindByName(ctx context.Context, name string) (*entity.Tag, error)
49
50	// GetAll retrieves all tags.
51	GetAll(ctx context.Context) ([]*entity.Tag, error)
52
53	// AssignToFavorite associates a tag with a favorite.
54	AssignToFavorite(ctx context.Context, tagID entity.TagID, favID entity.FavoriteID) error
55
56	// RemoveFromFavorite removes a tag association from a favorite.
57	RemoveFromFavorite(ctx context.Context, tagID entity.TagID, favID entity.FavoriteID) error
58
59	// GetForFavorite retrieves all tags associated with a favorite.
60	GetForFavorite(ctx context.Context, favID entity.FavoriteID) ([]*entity.Tag, error)
61
62	// Delete removes a tag by ID.
63	Delete(ctx context.Context, id entity.TagID) 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