getTableId
The getTableId
method returns the Id
of the underlying Table
that is backing an Index
.
getTableId(indexId: string): undefined | string
Type | Description | |
---|---|---|
indexId | string | |
returns | undefined | string |
If the Index
Id
is invalid, the method returns undefined
.
Example
This example creates an Indexes
object, a single Index
definition, and then queries it (and a non-existent definition) to get the underlying Table
Id
.
import {createIndexes, createStore} from 'tinybase';
const indexes = createIndexes(createStore());
indexes.setIndexDefinition('bySpecies', 'pets', 'species');
console.log(indexes.getTableId('bySpecies'));
// -> 'pets'
console.log(indexes.getTableId('byColor'));
// -> undefined
Since
v1.0.0