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

Function framed

packages/sql/pg/src/PgTypes.ts:1868–1879  ·  view source on GitHub ↗
(headerSize: number, parts: ReadonlyArray<Uint8Array>)

Source from the content-addressed store, hash-verified

1866
1867/** `headerSize` bytes for the caller to fill, then each part behind its int32 length. */
1868const framed = (headerSize: number, parts: ReadonlyArray<Uint8Array>): Uint8Array => {
1869 let size = headerSize
1870 for (const part of parts) size += 4 + part.length
1871 const bytes = new Uint8Array(size)
1872 let offset = headerSize
1873 for (const part of parts) {
1874 writeInt32(bytes, offset, part.length)
1875 bytes.set(part, offset + 4)
1876 offset += 4 + part.length
1877 }
1878 return bytes
1879}
1880
1881const writeFramed = (sink: ValueSink, value: unknown, oid: number, lookup: Lookup): void => {
1882 const token = sink.beginLength()

Callers 2

encodeRangeFunction · 0.70
encodeMultirangeFunction · 0.70

Calls 2

writeInt32Function · 0.85
setMethod · 0.65

Tested by

no test coverage detected