TinyBase logoTinyBase

getTableId

The getTableId method returns the Id of the underlying Table that is backing an Index.

getTableId(indexId: string): undefined | string
TypeDescription
indexIdstring

The Id of an Index.

returnsundefined | string

The Id of the Table backing the Index, or undefined.

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.

const indexes = createIndexes(createStore());
indexes.setIndexDefinition('bySpecies', 'pets', 'species');

console.log(indexes.getTableId('bySpecies'));
// -> 'pets'
console.log(indexes.getTableId('byColor'));
// -> undefined