Skip to content

Commit aee4f0c

Browse files
committed
Clean
1 parent 45995f4 commit aee4f0c

File tree

2 files changed

+14
-25
lines changed

2 files changed

+14
-25
lines changed

cjs/frontend.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,17 @@ module.exports = {
7474
7575
*/
7676

77-
function connect({ user, database }) {
77+
function connect({ user, database, connection }) {
7878
return bytes
7979
.inc(4)
8080
.i16(3)
8181
.z(2)
82-
.str(['user', user, 'database', database, 'client_encoding', '\'utf-8\''].join(N))
82+
.str(Object.entries({
83+
user,
84+
database,
85+
client_encoding: '\'utf-8\'',
86+
...connection
87+
}).filter(([k, v]) => v).map(([k, v]) => k + N + v).join(N))
8388
.z(2)
8489
.end(0)
8590
}

lib/backend.js

+7-23
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,9 @@ function Backend({
5353

5454
return backend
5555

56-
function ParseComplete() {
57-
// No handling needed
58-
}
59-
60-
function BindComplete() {
61-
// No handling needed
62-
}
63-
64-
function CloseComplete() {
65-
// No handling needed
66-
}
56+
function ParseComplete() { /* No handling needed */ }
57+
function BindComplete() { /* No handling needed */ }
58+
function CloseComplete() { /* No handling needed */ }
6759

6860
function NotificationResponse(x) {
6961
if (!onnotify)
@@ -96,9 +88,7 @@ function Backend({
9688
)
9789
}
9890

99-
function CopyDone(x) {
100-
// No handling needed
101-
}
91+
function CopyDone(x) { /* No handling needed */ }
10292

10393
function DataRow(x) {
10494
let index = 7
@@ -125,9 +115,7 @@ function Backend({
125115
: backend.query.result.push(row)
126116
}
127117

128-
function CopyData(x) {
129-
// No handling needed until implemented
130-
}
118+
function CopyData(x) { /* No handling needed until implemented */ }
131119

132120
function ErrorResponse(x) {
133121
reject(errors.generic(error(x)))
@@ -141,9 +129,7 @@ function Backend({
141129
reject(errors.notSupported('CopyOutResponse'))
142130
}
143131

144-
function EmptyQueryResponse() {
145-
// No handling needed
146-
}
132+
function EmptyQueryResponse() { /* No handling needed */ }
147133

148134
function BackendKeyData(x) {
149135
state.pid = x.readInt32BE(5)
@@ -156,9 +142,7 @@ function Backend({
156142
: console.log(error(x))
157143
}
158144

159-
function NoData(x) {
160-
// No handling needed
161-
}
145+
function NoData(x) { /* No handling needed */ }
162146

163147
function Authentication(x) {
164148
const type = x.readInt32BE(5)

0 commit comments

Comments
 (0)