Skip to content

Commit

Permalink
give responsiblity of index values to generated index (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
mafintosh authored Sep 7, 2024
1 parent 743cbb4 commit 7531405
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions builder/codegen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/generated/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 7531405

Please sign in to comment.