.select()
Selects all records in a table, or a specific record, from the database.
Method Syntaxasync db.select<T>(thing)
Arguments | Description | ||
---|---|---|---|
thing required | The table name or a |
type Person = { id: string; name: string; }; // Select all records from a table const people = await db.select<Person>('person'); // Select a specific record from a table const person = await db.select<Person>(new RecordId('person', 'h5wxrf2ewk8xjxosxtyc')); const person = await db.select<Person>(new StringRecordId('person:h5wxrf2ewk8xjxosxtyc'));
This function will run the following query in the database.
SELECT * FROM $thing;