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

Method addCString

packages/pg-protocol/src/buffer-writer.ts:39–51  ·  view source on GitHub ↗
(string: string)

Source from the content-addressed store, hash-verified

37 }
38
39 public addCString(string: string): Writer {
40 if (!string) {
41 this.ensure(1)
42 } else {
43 const len = Buffer.byteLength(string)
44 this.ensure(len + 1) // +1 for null terminator
45 this.buffer.write(string, this.offset, 'utf-8')
46 this.offset += len
47 }
48
49 this.buffer[this.offset++] = 0 // null terminator
50 return this
51 }
52
53 public addString(string: string = ''): Writer {
54 const len = Buffer.byteLength(string)

Callers 10

test-buffers.jsFile · 0.45
startupFunction · 0.45
passwordFunction · 0.45
queryFunction · 0.45
parseFunction · 0.45
bindFunction · 0.45
serializer.tsFile · 0.45

Calls 2

ensureMethod · 0.95
writeMethod · 0.80

Tested by

no test coverage detected