function getByKey<T>(objectStore, key): Promise<T | undefined>;Defined in: packages/indexeddb-db-collection/src/wrapper.ts:391
Retrieves a single item by its key from an object store.
T
The type of the item
IDBObjectStore
The IDBObjectStore to read from
IDBValidKey
The key of the item to retrieve
Promise<T | undefined>
A promise that resolves to the item, or undefined if not found
await executeTransaction(db, 'todos', 'readonly', async (tx, stores) => {
const todo = await getByKey<Todo>(stores.todos, 1)
if (todo) {
console.log('Found todo:', todo)
}
})