(fields: ReadonlyArray<string | Uint8Array>)
| 48 | assert.deepStrictEqual(normalize(decodeEffect()), normalize(decodePostgresJs())) |
| 49 | |
| 50 | const makeDataRow = (fields: ReadonlyArray<string | Uint8Array>): Uint8Array => { |
| 51 | const encoded = fields.map((field) => typeof field === "string" ? Buffer.from(field, "utf8") : Buffer.from(field)) |
| 52 | const length = 4 + 2 + encoded.reduce((total, field) => total + 4 + field.length, 0) |
| 53 | const frame = Buffer.allocUnsafe(1 + length) |
| 54 | frame[0] = 0x44 |
| 55 | frame.writeInt32BE(length, 1) |
| 56 | frame.writeInt16BE(encoded.length, 5) |
| 57 | let offset = 7 |
| 58 | for (const field of encoded) { |
| 59 | frame.writeInt32BE(field.length, offset) |
| 60 | offset += 4 |
| 61 | field.copy(frame, offset) |
| 62 | offset += field.length |
| 63 | } |
| 64 | return frame |
| 65 | } |
| 66 | |
| 67 | const rowsPerParserRun = 100 |
| 68 | const dataRow = makeDataRow(payload.map(({ text }) => text)) |
no test coverage detected