diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-04-25 22:31:01 +0200 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-04-25 22:31:01 +0200 |
commit | 65fd7bc9218f1bb0b4a5dd8d8141239b3211e1cd (patch) | |
tree | 66902f9d4932a4aae43d72aab003ee14d3f8b8c5 /cmd | |
parent | b7ca1117b18e228b84dd62a677a0a2ca52b3c549 (diff) | |
download | dict-65fd7bc9218f1bb0b4a5dd8d8141239b3211e1cd.tar.gz dict-65fd7bc9218f1bb0b4a5dd8d8141239b3211e1cd.tar.bz2 dict-65fd7bc9218f1bb0b4a5dd8d8141239b3211e1cd.zip |
ref: Use storage instead of memory
With async search we can afford waiting a bit more it to load without
making the ui sluggish.
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/ui/ui.go | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/cmd/ui/ui.go b/cmd/ui/ui.go index 50b8543..a12a666 100644 --- a/cmd/ui/ui.go +++ b/cmd/ui/ui.go @@ -13,10 +13,6 @@ import ( "git.gabrielgio.me/dict/db" ) -const ( - memory = ":memory:" -) - var UICommand = &cli.Command{ Name: "ui", Usage: "interactive dictionary", @@ -34,12 +30,7 @@ var UICommand = &cli.Command{ } func Run(ctx context.Context, name string) error { - db, err := db.Open(memory) - if err != nil { - return err - } - - err = db.Restore(ctx, name) + db, err := db.Open(name) if err != nil { return err } @@ -61,7 +52,7 @@ func Run(ctx context.Context, name string) error { search = v go func(v string) { - words, err := db.SelectDict(ctx, v, 100) + words, err := db.SelectDict(ctx, v, 20) if err != nil { return } |