Function
| Static Public Summary | ||
| public |
toNanoDate(timestamp: *): * Covers a nanoseconds unix timestamp to a INanoDate for node-influx. |
|
| Static Private Summary | ||
| private |
assertNoErrors(res: *): * Checks if there are any errors in the IResponse and, if so, it throws them. |
|
| private |
castTimestamp(timestamp: *, precision: *): * Converts a timestamp to a string with the correct precision. |
|
| private |
coerceBadly(fields: *): * Coerces the field map to a set of writable values, a la coerceFields, using native guesses based on the field datatypes. |
|
| private |
dateToTime(date: *, precision: *): * Converts a Date instance to a timestamp with the specified time precision. |
|
| private |
formatDate(date: *): * FormatDate converts the Date instance to Influx's date query format. |
|
| private |
isoOrTimeToDate(stamp: *, precision: string): * Converts an ISO-formatted data or unix timestamp to a Date instance. |
|
| private |
parse(res: *, precision: *): * From parses out a response to a result or list of responses. |
|
| private |
parseSingle(res: *, precision: *): * ParseSingle asserts that the response contains a single result, and returns that result. |
|
Static Public
public toNanoDate(timestamp: *): * source
import {toNanoDate} from 'influx/src/grammar/times.js'Covers a nanoseconds unix timestamp to a INanoDate for node-influx. The timestamp is provided as a string to prevent precision loss.
Please see A Moment for Times for a more complete and eloquent explanation of time handling in this module.
Params:
| Name | Type | Attribute | Description |
| timestamp | * |
Return:
| * |
Example:
const date = toNanoDate('1475985480231035600')
// You can use the returned Date as a normal date:
expect(date.getTime()).to.equal(1475985480231);
// We decorate it with two additional methods to read
// nanosecond-precision results:
expect(date.getNanoTime()).to.equal('1475985480231035600');
expect(date.toNanoISOString()).to.equal('2016-10-09T03:58:00.231035600Z');
Static Private
private assertNoErrors(res: *): * source
import {assertNoErrors} from 'influx/src/results.js'Checks if there are any errors in the IResponse and, if so, it throws them.
Params:
| Name | Type | Attribute | Description |
| res | * |
Return:
| * |
Throw:
private castTimestamp(timestamp: *, precision: *): * source
import {castTimestamp} from 'influx/src/grammar/times.js'Converts a timestamp to a string with the correct precision. Assumes that raw number and string instances are already in the correct precision.
Params:
| Name | Type | Attribute | Description |
| timestamp | * | ||
| precision | * |
Return:
| * |
private coerceBadly(fields: *): * source
import {coerceBadly} from 'influx/src/schema.js'Coerces the field map to a set of writable values, a la coerceFields, using native guesses based on the field datatypes.
Params:
| Name | Type | Attribute | Description |
| fields | * |
Return:
| * |
private dateToTime(date: *, precision: *): * source
import {dateToTime} from 'influx/src/grammar/times.js'Converts a Date instance to a timestamp with the specified time precision.
Params:
| Name | Type | Attribute | Description |
| date | * | ||
| precision | * |
Return:
| * |
private formatDate(date: *): * source
import {formatDate} from 'influx/src/grammar/times.js'FormatDate converts the Date instance to Influx's date query format.
Params:
| Name | Type | Attribute | Description |
| date | * |
Return:
| * |
private isoOrTimeToDate(stamp: *, precision: string): * source
import {isoOrTimeToDate} from 'influx/src/grammar/times.js'Converts an ISO-formatted data or unix timestamp to a Date instance. If the precision is finer than 'ms' the returned value will be a INanoDate.
Params:
| Name | Type | Attribute | Description |
| stamp | * | ||
| precision | string |
|
Return:
| * |
private parse(res: *, precision: *): * source
import {parse} from 'influx/src/results.js'From parses out a response to a result or list of responses. There are three situations we cover here:
- A single query without groups, like
select * from myseries - A single query with groups, generated with a
group bystatement which groups by series tags, grouping by times is case (1) - Multiple queries of types 1 and 2
Params:
| Name | Type | Attribute | Description |
| res | * | ||
| precision | * |
Return:
| * |
private parseSingle(res: *, precision: *): * source
import {parseSingle} from 'influx/src/results.js'ParseSingle asserts that the response contains a single result, and returns that result.
Params:
| Name | Type | Attribute | Description |
| res | * | ||
| precision | * |
Return:
| * |
Throw:
if the number of results is not exactly one |
