Skip to content

Commit 34ea6f0

Browse files
committed
Remove unused
1 parent 9ccf88c commit 34ea6f0

File tree

3 files changed

+5
-55
lines changed

3 files changed

+5
-55
lines changed

lib/bytes.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ const b = {
3030
b.i = 5
3131
return b
3232
},
33-
dec(x) {
34-
b.i -= x
35-
return b
36-
},
3733
inc(x) {
3834
b.i += x
3935
return b
@@ -44,11 +40,7 @@ const b = {
4440
b.i += buffer.utf8Write(x, b.i, length)
4541
return b
4642
},
47-
i16(x, i) {
48-
if (i || i === 0) {
49-
buffer.writeUInt16BE(x, i)
50-
return b
51-
}
43+
i16(x) {
5244
fit(2)
5345
buffer.writeUInt16BE(x, b.i)
5446
b.i += 2
@@ -70,12 +62,6 @@ const b = {
7062
b.i += x
7163
return b
7264
},
73-
push(x) {
74-
fit(x.length)
75-
x.copy(buffer, b.i)
76-
b.i += x.length
77-
return b
78-
},
7965
end(at = 1) {
8066
buffer.writeUInt32BE(b.i - at, at)
8167
const out = buffer.slice(0, b.i)

lib/connection.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,15 @@ function postgresSocket(options, {
179179
}) {
180180
let socket
181181
let closed = true
182-
let ended = false
183182

184183
return {
185184
ready: false,
186185
write: x => socket.write(x),
187186
destroy: () => {
188-
ended = true
189187
socket.destroy()
190188
return Promise.resolve()
191189
},
192190
end: () => {
193-
ended = true
194191
return new Promise(r => socket.end(r))
195192
},
196193
connect

lib/frontend.js

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,12 @@ const authNames = {
2525
}
2626

2727
const auths = {
28-
2 : authNotImplemented,
29-
3 : authNotImplemented,
3028
5 : AuthenticationMD5Password,
31-
6 : authNotImplemented,
32-
7 : authNotImplemented,
33-
8 : authNotImplemented,
34-
9 : authNotImplemented,
3529
10: SASL,
3630
11: SASLContinue,
3731
12: SASLFinal
3832
}
3933

40-
const messages = {
41-
B : 'Bind',
42-
C : 'Close',
43-
D : 'Describe',
44-
E : 'Execute',
45-
F : 'FunctionCall',
46-
f : 'CopyFail',
47-
H : 'Flush',
48-
P : 'Parse',
49-
p : 'PasswordMessage',
50-
S : 'Sync',
51-
Q : 'Query',
52-
X : 'Terminate'
53-
}
5434

5535
export default {
5636
connect,
@@ -60,20 +40,6 @@ export default {
6040
Query
6141
}
6242

63-
/* Other messages
64-
65-
Close (C)
66-
Describe (D)
67-
Execute (F)
68-
FunctionCall (F)
69-
CopyFail (f)
70-
Flush (H)
71-
PasswordMessage (p)
72-
Sync (S)
73-
Terminate (X)
74-
75-
*/
76-
7743
function connect({ user, database, connection }) {
7844
return bytes
7945
.inc(4)
@@ -84,13 +50,14 @@ function connect({ user, database, connection }) {
8450
database,
8551
client_encoding: '\'utf-8\'',
8652
...connection
87-
}).filter(([k, v]) => v).map(([k, v]) => k + N + v).join(N))
53+
}).filter(([, v]) => v).map(([k, v]) => k + N + v).join(N))
8854
.z(2)
8955
.end(0)
9056
}
9157

9258
function auth(type, x, options) {
93-
return auths[type](type, x, options) || ''
59+
return (auths[type] || authNotImplemented)(type, x, options) || ''
60+
}
9461
}
9562

9663
function AuthenticationMD5Password(type, x, { user, pass }) {
@@ -172,7 +139,7 @@ function Bind(name, args) {
172139
.i16(0)
173140
.i16(args.length)
174141

175-
args.forEach((x, i) => {
142+
args.forEach(x => {
176143
if (x.value == null)
177144
return bytes.i32(0xFFFFFFFF)
178145

0 commit comments

Comments
 (0)