MCPcopy Create free account
hub / github.com/porsager/postgres / data

Function data

deno/src/connection.js:304–336  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

302 }
303
304 function data(x) {
305 if (incomings) {
306 incomings.push(x)
307 remaining -= x.length
308 if (remaining > 0)
309 return
310 }
311
312 incoming = incomings
313 ? Buffer.concat(incomings, length - remaining)
314 : incoming.length === 0
315 ? x
316 : Buffer.concat([incoming, x], incoming.length + x.length)
317
318 while (incoming.length > 4) {
319 length = incoming.readUInt32BE(1)
320 if (length >= incoming.length) {
321 remaining = length - incoming.length
322 incomings = [incoming]
323 break
324 }
325
326 try {
327 handle(incoming.subarray(0, length + 1))
328 } catch (e) {
329 query && (query.cursorFn || query.describeFirst) && write(Sync)
330 errored(e)
331 }
332 incoming = incoming.subarray(length + 1)
333 remaining = 0
334 incomings = null
335 }
336 }
337
338 async function connect() {
339 terminated = false

Callers

nothing calls this directly

Calls 3

handleFunction · 0.70
writeFunction · 0.70
erroredFunction · 0.70

Tested by

no test coverage detected