MCPcopy Create free account
hub / github.com/porsager/postgres / Connection

Function Connection

cf/src/connection.js:54–1010  ·  view source on GitHub ↗
(options, queues = {}, { onopen = noop, onend = noop, onclose = noop } = {})

Source from the content-addressed store, hash-verified

52}
53
54function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose = noop } = {}) {
55 const {
56 sslnegotiation,
57 ssl,
58 max,
59 user,
60 host,
61 port,
62 database,
63 parsers,
64 transform,
65 onnotice,
66 onnotify,
67 onparameter,
68 max_pipeline,
69 keep_alive,
70 backoff,
71 target_session_attrs
72 } = options
73
74 const sent = Queue()
75 , id = uid++
76 , backend = { pid: null, secret: null }
77 , idleTimer = timer(end, options.idle_timeout)
78 , lifeTimer = timer(end, options.max_lifetime)
79 , connectTimer = timer(connectTimedOut, options.connect_timeout)
80
81 let socket = null
82 , cancelMessage
83 , errorResponse = null
84 , result = new Result()
85 , incoming = Buffer.alloc(0)
86 , needsTypes = options.fetch_types
87 , backendParameters = {}
88 , statements = {}
89 , statementId = Math.random().toString(36).slice(2)
90 , statementCount = 1
91 , closedTime = 0
92 , remaining = 0
93 , hostIndex = 0
94 , retries = 0
95 , length = 0
96 , delay = 0
97 , rows = 0
98 , serverSignature = null
99 , nextWriteTimer = null
100 , terminated = false
101 , incomings = null
102 , results = null
103 , initial = null
104 , ending = null
105 , stream = null
106 , chunk = null
107 , ended = null
108 , nonce = null
109 , query = null
110 , final = null
111

Callers 3

PostgresFunction · 0.70
cancelFunction · 0.70
ReadyForQueryFunction · 0.70

Calls 2

QueueFunction · 0.70
timerFunction · 0.70

Tested by

no test coverage detected