MCPcopy
hub / github.com/prisma/prisma / getBatchId

Function getBatchId

packages/client/src/runtime/core/jsonProtocol/getBatchId.ts:3–18  ·  view source on GitHub ↗
(query: JsonQuery)

Source from the content-addressed store, hash-verified

1import { JsonQuery } from '../engines'
2
3export function getBatchId(query: JsonQuery): string | undefined {
4 if (query.action !== 'findUnique' && query.action !== 'findUniqueOrThrow') {
5 return undefined
6 }
7 const parts: string[] = []
8 if (query.modelName) {
9 parts.push(query.modelName)
10 }
11
12 if (query.query.arguments) {
13 parts.push(buildKeysString(query.query.arguments))
14 }
15 parts.push(buildKeysString(query.query.selection))
16
17 return parts.join('')
18}
19
20function buildKeysString(obj: object): string {
21 const keysArray = Object.keys(obj)

Callers 2

constructorMethod · 0.90
getBatchId.test.tsFile · 0.90

Calls 2

buildKeysStringFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected