MCPcopy Create free account
hub / github.com/Effect-TS/effect / getCount

Function getCount

packages/platform/browser/src/IndexedDbQueryBuilder.ts:1312–1332  ·  view source on GitHub ↗
(query: IndexedDbQuery.Count<any, never>)

Source from the content-addressed store, hash-verified

1310 })
1311
1312const getCount = (query: IndexedDbQuery.Count<any, never>) =>
1313 Effect.callback<number, IndexedDbQueryError>((resume) => {
1314 const { keyRange, store } = getReadonlyObjectStore(query)
1315
1316 const request = store.count(keyRange)
1317
1318 request.onerror = (event) => {
1319 resume(
1320 Effect.fail(
1321 new IndexedDbQueryError({
1322 reason: "TransactionError",
1323 cause: event
1324 })
1325 )
1326 )
1327 }
1328
1329 request.onsuccess = () => {
1330 resume(Effect.succeed(request.result))
1331 }
1332 })
1333
1334const FromProto: Omit<
1335 IndexedDbQuery.From<any>,

Callers 1

evaluateFunction · 0.85

Calls 5

getReadonlyObjectStoreFunction · 0.85
countMethod · 0.80
resumeFunction · 0.50
failMethod · 0.45
succeedMethod · 0.45

Tested by

no test coverage detected