From 75314050f2ba087dfcde85e59d9054b343a1f99d Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Sat, 7 Sep 2024 14:00:43 +0200 Subject: [PATCH] give responsiblity of index values to generated index (#1) --- builder/codegen.js | 2 ++ test/fixtures/generated/index.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/builder/codegen.js b/builder/codegen.js index 682d7da..c0169a1 100644 --- a/builder/codegen.js +++ b/builder/codegen.js @@ -185,6 +185,8 @@ function generateIndexDefinition (id, index) { str += ` name: ${s(index.fqn)},\n` str += ` encodeKey: ${generateEncodeIndexKey(id, index)},\n` str += ` encodeKeyRange: ${generateEncodeKeyRange(id, index)},\n` + str += ` encodeValue: (doc) => ${id}.encodeKey(doc),\n` + str += ' reconstruct: (keyBuf, valueBuf) => valueBuf,\n' str += ' offset: 0,\n' str += ' collection: null\n' str += '}\n' diff --git a/test/fixtures/generated/index.js b/test/fixtures/generated/index.js index ad8caa2..02f5fc6 100644 --- a/test/fixtures/generated/index.js +++ b/test/fixtures/generated/index.js @@ -89,6 +89,8 @@ const index0 = { lte: lte ? index0_indexify(lte) : null }) }, + encodeValue: (doc) => index0.encodeKey(doc), + reconstruct: (keyBuf, valueBuf) => valueBuf, offset: 0, collection: null }