lockbox

password manager
Log | Files | Refs | README | LICENSE

commit 3eacd0cdec5dc12848d75f52a7db8d131330b7de
parent 420be427cb615c577c223dba0aebf790f33a5fba
Author: Sean Enck <sean@ttypty.com>
Date:   Tue,  3 Feb 2026 16:46:27 -0500

insert in order and sort later (as needed)

Diffstat:
Minternal/kdbx/query.go | 15++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/internal/kdbx/query.go b/internal/kdbx/query.go @@ -142,15 +142,7 @@ func (t *Transaction) QueryCallback(args QueryOptions) (QuerySeq2, error) { } } } - obj := entity{backing: entry, path: path} - if isSort && len(entities) > 0 { - i, _ := slices.BinarySearchFunc(entities, obj, func(i, j entity) int { - return strings.Compare(i.path, j.path) - }) - entities = slices.Insert(entities, i, obj) - } else { - entities = append(entities, obj) - } + entities = append(entities, entity{backing: entry, path: path}) return nil }) if decrypt { @@ -161,6 +153,11 @@ func (t *Transaction) QueryCallback(args QueryOptions) (QuerySeq2, error) { if err != nil { return nil, err } + if isSort { + slices.SortFunc(entities, func(i, j entity) int { + return strings.Compare(i.path, j.path) + }) + } hasher, err := NewHasher(args.Values) if err != nil { return nil, err