Class: MapIndex
Defined in: packages/core/src/indices/map-index.ts:13
A simple secondary index based on JavaScript Maps.
Implements
Constructors
Constructor
new MapIndex(
expressions,db):MapIndex
Defined in: packages/core/src/indices/map-index.ts:21
Parameters
| Parameter | Type |
|---|---|
expressions | Calculation[] |
db | DortDBAsFriend |
Returns
MapIndex
Properties
calcBuilders
protectedcalcBuilders:Record<string,PlanVisitor<CalculationParams>>
Defined in: packages/core/src/indices/map-index.ts:19
Per-language calculation-builder visitors used to compile plan operators into Calculation instances.
eqCheckers
protectedeqCheckers:Record<string,EqualityChecker>
Defined in: packages/core/src/indices/map-index.ts:17
Per-language EqualityChecker visitors used to compare index expressions structurally.
expressions
expressions:
Calculation[]
Defined in: packages/core/src/indices/map-index.ts:22
The indexed expressions. More expressions result in multi-level index.
Implementation of
map
protectedmap:Map<unknown,unknown[]>
Defined in: packages/core/src/indices/map-index.ts:15
Backing store: normalized key → list of source values.
Methods
allValues()
allValues():
Iterable<unknown[]>
Defined in: packages/core/src/indices/map-index.ts:127
Iterate over all stored values. Used in full outer joins.
Returns
Iterable<unknown[]>
Implementation of
createAccessor()
createAccessor(
expressions):Calculation
Defined in: packages/core/src/indices/map-index.ts:105
Create an accessor for the given expressions.
Parameters
| Parameter | Type | Description |
|---|---|---|
expressions | IndexMatchInput[] | expressions matched by match |
Returns
- a calculation returning iterable of matched values
Implementation of
getAlternatives()
protectedgetAlternatives(value):unknown[]
Defined in: packages/core/src/indices/map-index.ts:76
The default equality comparison is not strict. This method returns alternative values that are considered equal.
Parameters
| Parameter | Type |
|---|---|
value | unknown |
Returns
unknown[]
match()
match(
expressions,renameMap?):number[]
Defined in: packages/core/src/indices/map-index.ts:46
Can the index be used to match the given expressions?
Parameters
| Parameter | Type | Description |
|---|---|---|
expressions | IndexMatchInput[] | expressions to match against the index |
renameMap? | RenameMap | rename the expressions before matching |
Returns
number[]
- ordered indices of the expressions that can be matched, or null if none can be matched
Implementation of
normalizeKey()
protectednormalizeKey(value):unknown
Defined in: packages/core/src/indices/map-index.ts:100
Normalizes a key before storage or lookup; maps undefined to null.
Parameters
| Parameter | Type |
|---|---|
value | unknown |
Returns
unknown
reindex()
reindex(
values):void
Defined in: packages/core/src/indices/map-index.ts:32
Rebuild the index with new values.
Parameters
| Parameter | Type | Description |
|---|---|---|
values | Iterable<IndexFillInput> | the new values to index |
Returns
void
Implementation of
canIndex()
staticcanIndex(expressions):number[]
Defined in: packages/core/src/indices/map-index.ts:67
Returns the index of the first equality expression that this index type can handle, or null if none qualify.
Parameters
| Parameter | Type |
|---|---|
expressions | IndexMatchInput[] |
Returns
number[]