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

Function makeScripted

packages/sql/pg/test/PgConnection.in-process.test.ts:438–454  ·  view source on GitHub ↗
(reply: (write: Buffer) => Buffer)

Source from the content-addressed store, hash-verified

436
437 describe("batch", () => {
438 const makeScripted = (reply: (write: Buffer) => Buffer) => {
439 const writes: Array<Buffer> = []
440 const socket: Duplex = new Duplex({
441 read() {},
442 write(chunk: Buffer, _encoding, callback) {
443 const message = Buffer.from(chunk)
444 writes.push(message)
445 queueMicrotask(() =>
446 socket.push(
447 writes.length === 1 ? Buffer.concat([authenticationOk, backendKeyData, readyForQuery]) : reply(message)
448 )
449 )
450 callback()
451 }
452 })
453 return { socket, writes }
454 }
455
456 const column = (name: string, oid: number) =>
457 backendMessage(

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected