Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 618b094

Browse files
committed
chore: update lint
1 parent c355ada commit 618b094

File tree

3 files changed

+32
-33
lines changed

3 files changed

+32
-33
lines changed

‎packages/pg/lib/native/client.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Client.prototype._connect = function (cb) {
104104
self._connected = true
105105

106106
// Add a reference to the client for error bubbling
107-
self.native.connection = self;
107+
self.native.connection = self
108108

109109
// handle connection errors from the native layer
110110
self.native.on('error', function (err) {
@@ -202,7 +202,7 @@ Client.prototype.query = function (config, values, callback) {
202202

203203
// we already returned an error,
204204
// just do nothing if query completes
205-
query.callback = () => {}
205+
query.callback = () => {}
206206

207207
// Remove from queue
208208
var index = this._queryQueue.indexOf(query)
@@ -295,14 +295,14 @@ Client.prototype._pulseQueryQueue = function (initialConnection) {
295295
// attempt to cancel an in-progress query
296296
Client.prototype.cancel = function (query) {
297297
if (this._activeQuery === query) {
298-
this.native.cancel(function () {})
298+
this.native.cancel(function () {})
299299
} else if (this._queryQueue.indexOf(query) !== -1) {
300300
this._queryQueue.splice(this._queryQueue.indexOf(query), 1)
301301
}
302302
}
303303

304-
Client.prototype.ref = function () {}
305-
Client.prototype.unref = function () {}
304+
Client.prototype.ref = function () {}
305+
Client.prototype.unref = function () {}
306306

307307
Client.prototype.setTypeParser = function (oid, format, parseFn) {
308308
return this._types.setTypeParser(oid, format, parseFn)

‎packages/pg/lib/native/query.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ NativeQuery.prototype.handleError = function (err) {
6262
if (this.native && this.native.connection) {
6363
// Need to emit the error on the client/connection level too
6464
process.nextTick(() => {
65-
this.native.connection.emit('error', err);
66-
});
65+
this.native.connection.emit('error', err)
66+
})
6767
}
6868
}
6969

@@ -117,24 +117,24 @@ NativeQuery.prototype.submit = function (client) {
117117
// Check the result size if maxResultSize is configured
118118
if (self._maxResultSize) {
119119
// Calculate result size (rough approximation)
120-
let resultSize = 0;
120+
let resultSize = 0
121121

122122
// For multiple result sets
123123
if (results.length > 1) {
124124
for (let i = 0; i < rows.length; i++) {
125-
resultSize += self._calculateResultSize(rows[i]);
125+
resultSize += self._calculateResultSize(rows[i])
126126
}
127127
} else if (rows.length > 0) {
128-
resultSize = self._calculateResultSize(rows);
128+
resultSize = self._calculateResultSize(rows)
129129
}
130130

131131
// If the size limit is exceeded, generate an error
132132
if (resultSize > self._maxResultSize) {
133-
const error = new Error('Query result size exceeded the configured limit');
134-
error.code = 'RESULT_SIZE_EXCEEDED';
135-
error.resultSize = resultSize;
136-
error.maxResultSize = self._maxResultSize;
137-
return self.handleError(error);
133+
const error = new Error('Query result size exceeded the configured limit')
134+
error.code = 'RESULT_SIZE_EXCEEDED'
135+
error.resultSize = resultSize
136+
error.maxResultSize = self._maxResultSize
137+
return self.handleError(error)
138138
}
139139
}
140140

@@ -207,56 +207,56 @@ NativeQuery.prototype.submit = function (client) {
207207

208208
// Helper method to estimate the size of a result set
209209
NativeQuery.prototype._calculateResultSize = function (rows) {
210-
let size = 0;
210+
let size = 0
211211

212212
// For empty results, return 0
213213
if (!rows || rows.length === 0) {
214-
return 0;
214+
return 0
215215
}
216216

217217
// For array mode, calculate differently
218218
if (this._arrayMode) {
219219
// Just use a rough approximation based on number of rows
220-
return rows.length * 100;
220+
return rows.length * 100
221221
}
222222

223223
// For each row, approximate its size
224224
for (let i = 0; i < rows.length; i++) {
225-
const row = rows[i];
225+
const row = rows[i]
226226

227227
// Add base row size
228-
size += 24; // Overhead per row
228+
size += 24 // Overhead per row
229229

230230
// Add size of each column
231231
for (const key in row) {
232232
if (Object.prototype.hasOwnProperty.call(row, key)) {
233-
const value = row[key];
233+
const value = row[key]
234234

235235
// Add key size
236-
size += key.length * 2; // Assume 2 bytes per character
236+
size += key.length * 2 // Assume 2 bytes per character
237237

238238
// Add value size based on type
239239
if (value === null || value === undefined) {
240-
size += 8;
240+
size += 8
241241
} else if (typeof value === 'string') {
242-
size += value.length * 2; // Assume 2 bytes per character
242+
size += value.length * 2 // Assume 2 bytes per character
243243
} else if (typeof value === 'number') {
244-
size += 8;
244+
size += 8
245245
} else if (typeof value === 'boolean') {
246-
size += 4;
246+
size += 4
247247
} else if (value instanceof Date) {
248-
size += 8;
248+
size += 8
249249
} else if (Buffer.isBuffer(value)) {
250-
size += value.length;
250+
size += value.length
251251
} else if (Array.isArray(value)) {
252-
size += 16 + value.length * 8;
252+
size += 16 + value.length * 8
253253
} else {
254254
// For objects, use a rough estimate
255-
size += 32 + JSON.stringify(value).length * 2;
255+
size += 32 + JSON.stringify(value).length * 2
256256
}
257257
}
258258
}
259259
}
260260

261-
return size;
261+
return size
262262
}

‎packages/pg/test/integration/client/max-result-size-tests.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ suite.test('maxResultSize limit triggers error', (cb) => {
3535
console.log('Client error event:', err.message, err.code)
3636

3737
// If we get any size exceeded error, mark it
38-
if (err.code === 'RESULT_SIZE_EXCEEDED' ||
39-
err.message === 'Query result size exceeded the configured limit') {
38+
if (err.code === 'RESULT_SIZE_EXCEEDED' || err.message === 'Query result size exceeded the configured limit') {
4039
sizeExceededErrorSeen = true
4140
}
4241
})

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /