getTableId
The getTableId
method returns the Id
of the underlying Table
that is backing a query.
getTableId(queryId: string): undefined | string
Type | Description | |
---|---|---|
queryId | string | The |
returns | undefined | string |
If the query Id
is invalid, the method returns undefined
.
Example
This example creates a Queries
object, a single query definition, and then calls this method on it (as well as a non-existent definition) to get the underlying Table
Id
.
import {createQueries, createStore} from 'tinybase';
const queries = createQueries(createStore()).setQueryDefinition(
'dogColors',
'pets',
({select, where}) => {
select('color');
where('species', 'dog');
},
);
console.log(queries.getTableId('dogColors'));
// -> 'pets'
console.log(queries.getTableId('catColors'));
// -> undefined
Since
v2.0.0