Skip to content

Commit

Permalink
regen
Browse files Browse the repository at this point in the history
  • Loading branch information
mafintosh committed Sep 13, 2024
1 parent 7a5d8ea commit 0e7ee50
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion test/fixtures/generated/1/hyperdb/db.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"name": "members",
"namespace": "db",
"id": 0,
"stats": false,
"type": 1,
"indexes": [
"@db/members-by-age",
"@db/members-by-age"
],
"schema": "@db/member",
Expand All @@ -20,6 +20,7 @@
"name": "members-by-age",
"namespace": "db",
"id": 1,
"stats": false,
"type": 2,
"collection": "@db/members",
"unique": false,
Expand Down
10 changes: 6 additions & 4 deletions test/fixtures/generated/1/hyperdb/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ function collection0_reconstruct (version, keyBuf, valueBuf) {
// '@db/members'
const collection0 = {
name: '@db/members',
id: 0,
stats: false,
encodeKey: function encodeKey (record) {
const key = [record.id]
return collection0_key.encode(key)
Expand Down Expand Up @@ -75,8 +77,9 @@ function index0_indexify (record) {

// '@db/members-by-age'
const index0 = {
_collectionName: '@db/members',
name: '@db/members-by-age',
id: 1,
stats: false,
encodeKeys: function encodeKeys (record) {
const key = [record.age, record.id]
return [index0_key.encode(key)]
Expand All @@ -92,7 +95,7 @@ const index0 = {
encodeValue: (doc) => index0.collection.encodeKey(doc),
reconstruct: (keyBuf, valueBuf) => valueBuf,
offset: 0,
collection: null
collection: collection0
}

const IndexMap = new Map([
Expand All @@ -104,9 +107,8 @@ const CollectionMap = new Map([
const Collections = [...CollectionMap.values()]
const Indexes = [...IndexMap.values()]
for (const index of IndexMap.values()) {
const collection = CollectionMap.get(index._collectionName)
const collection = index.collection
collection.indexes.push(index)
index.collection = collection
index.offset = collection.indexes.length - 1
}

Expand Down
1 change: 0 additions & 1 deletion test/fixtures/generated/2/hyperdb/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ const Indexes = [...IndexMap.values()]
for (const index of IndexMap.values()) {
const collection = index.collection
collection.indexes.push(index)
index.collection = collection
index.offset = collection.indexes.length - 1
}

Expand Down

0 comments on commit 0e7ee50

Please sign in to comment.