MCPcopy Create free account
hub / github.com/TanStack/db / generateTxId

Function generateTxId

examples/react/todo/src/routes/api/config.ts:8–17  ·  view source on GitHub ↗
(tx: any)

Source from the content-addressed store, hash-verified

6
7// Generate a transaction ID
8async function generateTxId(tx: any): Promise<Txid> {
9 const result = await tx`SELECT pg_current_xact_id()::xid::text as txid`
10 const txid = result[0]?.txid
11
12 if (txid === undefined) {
13 throw new Error(`Failed to get transaction ID`)
14 }
15
16 return parseInt(txid, 10)
17}
18
19export const Route = createFileRoute(`/api/config`)({
20 server: {

Callers 1

config.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected