本页还没有译文
本页 18 段还没译成Tiếng Việt,下面显示的是英文原文。getByKey
还没翻译译自英文(tanstack.com)本页 18 段都还没译
function getByKey<T>(objectStore, key): Promise<T | undefined>;Defined in: packages/db/src/indexed-db-wrapper.ts:426
Retrieves a single item by its key from an object store.
Type Parameters
T
T
The type of the item
Parameters
objectStore
IDBObjectStore
The IDBObjectStore to read from
key
IDBValidKey
The key of the item to retrieve
Returns
Promise<T | undefined>
A promise that resolves to the item, or undefined if not found
Example
await executeTransaction(db, 'todos', 'readonly', async (tx, stores) => {
const todo = await getByKey<Todo>(stores.todos, 1)
if (todo) {
console.log('Found todo:', todo)
}
})AI 翻译查看英文原文