MCPcopy Index your code
hub / github.com/brianc/node-postgres / startup

Function startup

packages/pg-protocol/src/serializer.ts:21–36  ·  view source on GitHub ↗
(opts: Record<string, string>)

Source from the content-addressed store, hash-verified

19const writer = new Writer()
20
21const startup = (opts: Record<string, string>): Buffer => {
22 // protocol version
23 writer.addInt16(3).addInt16(0)
24 for (const key of Object.keys(opts)) {
25 writer.addCString(key).addCString(opts[key])
26 }
27
28 writer.addCString('client_encoding').addCString('UTF8')
29
30 const bodyBuffer = writer.addCString('').flush()
31 // this message is sent without a code
32
33 const length = bodyBuffer.length + 4
34
35 return new Writer().addInt32(length).add(bodyBuffer).flush()
36}
37
38const requestSsl = (): Buffer => {
39 const response = Buffer.allocUnsafe(8)

Callers

nothing calls this directly

Calls 5

addInt16Method · 0.45
addCStringMethod · 0.45
flushMethod · 0.45
addMethod · 0.45
addInt32Method · 0.45

Tested by

no test coverage detected