commit d9e2356e47f3a064cf739013957338322d7cc731
parent dadd6d24bdd8ff97ec8ead0069afb67edbd551f9
Author: lash <dev@holbrook.no>
Date: Wed, 15 Jan 2025 15:01:39 +0000
Exclude prefix in gdbm dump
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/db/gdbm/dump.go b/db/gdbm/dump.go
@@ -34,7 +34,7 @@ func(gdb *gdbmDb) Dump(ctx context.Context, key []byte) (*db.Dumper, error) {
return nil, err
}
gdb.itBase = key
- return db.NewDumper(gdb.dumpFunc).WithFirst(k, v), nil
+ return db.NewDumper(gdb.dumpFunc).WithFirst(k[1:], v), nil
}
gdb.it = nil
return nil, db.NewErrNotFound(key)
@@ -61,11 +61,12 @@ func(gdb *gdbmDb) dumpFunc(ctx context.Context) ([]byte, []byte) {
gdb.it = nil
return nil, nil
}
+ gdb.SetPrefix(k[0])
v, err := gdb.Get(ctx, k[1:])
if err != nil {
return nil, nil
}
- return k, v
+ return k[1:], v
}
//func(gdb *gdbmDb) After(ctx context.Context, keyPart []byte) ([]byte, []byte) {