summaryrefslogtreecommitdiffstats
path: root/tools/notes
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2025-10-01 03:09:25 -0700
committerRose Hogenson <rosehogenson@posteo.net>2025-10-01 03:09:25 -0700
commit298f4b4634026f268ad74dadccbca8127ab83076 (patch)
tree634c5602d32ac4c850fa2ec9619ff1cdef8f2cb5 /tools/notes
parentc2ca26a918b7054199234e8459d84ee2fd260759 (diff)
downloadroseh.moe-298f4b4634026f268ad74dadccbca8127ab83076.tar.zst
Fix the n^2 using a linked list
Diffstat (limited to 'tools/notes')
-rw-r--r--tools/notes/notes.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/notes/notes.go b/tools/notes/notes.go
index 2b03694..f22b7f9 100644
--- a/tools/notes/notes.go
+++ b/tools/notes/notes.go
@@ -211,19 +211,18 @@ func (*newCommand) SetFlags(*flag.FlagSet) {}
type createNoteRequestStreamWriter struct {
ctx context.Context
continuationToken []byte
- name string
}
func (w *createNoteRequestStreamWriter) Write(buf []byte) (int, error) {
resp, err := createNote(w.ctx, &api.CreateNoteRequest{
ContinuationToken: w.continuationToken,
Chunk: buf,
+ More: true,
})
if err != nil {
return 0, err
}
w.continuationToken = resp.ContinuationToken
- w.name = resp.Name
return len(buf), nil
}
@@ -237,7 +236,11 @@ func (*newCommand) new(ctx context.Context, fileName string) error {
if _, err := io.Copy(streamWriter, f); err != nil {
return err
}
- fmt.Println(streamWriter.name)
+ resp, err := createNote(ctx, &api.CreateNoteRequest{ContinuationToken: streamWriter.continuationToken})
+ if err != nil {
+ return err
+ }
+ fmt.Println(resp.Name)
return nil
}