@@ -357,46 +357,47 @@ <h1 class="page-title">Source: src/sender.js</h1>
357
357
checkCapacity(this, [valueStr], 1 + valueStr.length);
358
358
write(this, valueStr);
359
359
write(this, 'i');
360
- }, "number" );
360
+ });
361
361
return this;
362
362
}
363
363
364
364
/**
365
365
* Write a timestamp column with its value into the buffer of the sender.
366
366
*
367
367
* @param {string} name - Column name.
368
- * @param {number} value - Column value , accepts only number objects .
368
+ * @param {number | bigint } value - Epoch timestamp in microseconds , accepts only numbers or BigInts .
369
369
* @return {Sender} Returns with a reference to this sender.
370
370
*/
371
371
timestampColumn(name, value) {
372
- if (!Number.isInteger(value)) {
373
- throw new Error(`Value must be an integer, received ${value}`);
372
+ if (typeof value !== "bigint" && !Number.isInteger(value)) {
373
+ throw new Error(`Value must be an integer or BigInt , received ${value}`);
374
374
}
375
375
writeColumn(this, name, value, () => {
376
376
const valueStr = value.toString();
377
377
checkCapacity(this, [valueStr], 1 + valueStr.length);
378
378
write(this, valueStr);
379
379
write(this, 't');
380
- }, "number" );
380
+ });
381
381
return this;
382
382
}
383
383
384
384
/**
385
385
* Closing the row after writing the designated timestamp into the buffer of the sender.
386
386
*
387
- * @param {string} timestamp - A string represents the designated timestamp in nanoseconds.
387
+ * @param {string | bigint } timestamp - A string or BigInt that represents the designated timestamp in epoch nanoseconds.
388
388
*/
389
389
at(timestamp) {
390
390
if (!this.hasSymbols && !this.hasColumns) {
391
391
throw new Error("The row must have a symbol or column set before it is closed");
392
392
}
393
- if (typeof timestamp !== "string") {
394
- throw new Error(`The designated timestamp must be of type string, received ${typeof timestamp}`);
393
+ if (typeof timestamp !== "string" && typeof timestamp !== "bigint" ) {
394
+ throw new Error(`The designated timestamp must be of type string or BigInt , received ${typeof timestamp}`);
395
395
}
396
396
validateDesignatedTimestamp(timestamp);
397
- checkCapacity(this, [], 2 + timestamp.length);
397
+ const timestampStr = timestamp.toString();
398
+ checkCapacity(this, [], 2 + timestampStr.length);
398
399
write(this, ' ');
399
- write(this, timestamp );
400
+ write(this, timestampStr );
400
401
write(this, '\n');
401
402
startNewRow(this);
402
403
}
@@ -469,7 +470,7 @@ <h1 class="page-title">Source: src/sender.js</h1>
469
470
if (typeof name !== "string") {
470
471
throw new Error(`Column name must be a string, received ${typeof name}`);
471
472
}
472
- if (typeof value !== valueType) {
473
+ if (valueType != null && typeof value !== valueType) {
473
474
throw new Error(`Column value must be of type ${valueType}, received ${typeof value}`);
474
475
}
475
476
if (!sender.hasTable) {
@@ -529,7 +530,7 @@ <h1 class="page-title">Source: src/sender.js</h1>
529
530
}
530
531
531
532
exports.Sender = Sender;
532
- exports.DEFAULT_BUFFER_SIZE = DEFAULT_BUFFER_SIZE
533
+ exports.DEFAULT_BUFFER_SIZE = DEFAULT_BUFFER_SIZE;
533
534
</ code > </ pre >
534
535
</ article >
535
536
</ section >
@@ -546,7 +547,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-@q
546
547
< br class ="clear ">
547
548
548
549
< footer >
549
- Documentation generated by < a href ="https://github.com/jsdoc/jsdoc "> JSDoc 3.6.11</ a > on Fri May 26 2023 10:30:37 GMT+0100 (British Summer Time)
550
+ Documentation generated by < a href ="https://github.com/jsdoc/jsdoc "> JSDoc 3.6.11</ a > on Mon Sep 18 2023 15:34:51 GMT+0100 (British Summer Time)
550
551
</ footer >
551
552
552
553
< script > prettyPrint ( ) ; </ script >
0 commit comments