From 095a51c756f7693c129de0d6694cf5b5fdc523a4 Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Tue, 19 Sep 2023 09:15:29 +0200 Subject: [PATCH] chore: simplify queryPoints --- packages/client/src/InfluxDBClient.ts | 8 ++------ packages/client/test/unit/util/point.test.ts | 1 + 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/client/src/InfluxDBClient.ts b/packages/client/src/InfluxDBClient.ts index 64f8384f..9fa2a0bb 100644 --- a/packages/client/src/InfluxDBClient.ts +++ b/packages/client/src/InfluxDBClient.ts @@ -98,22 +98,18 @@ export default class InfluxDBClient { * @param queryType - The type of query (default: 'sql'). * @returns An async generator that yields PointValues object. */ - async *queryPoints( + queryPoints( query: string, database?: string, queryType: QueryType = 'sql' ): AsyncGenerator { - const points = this._queryApi.queryPoints( + return this._queryApi.queryPoints( query, database ?? this._options.database ?? throwReturn(new Error(argumentErrorMessage)), queryType ) - - for await (const point of points) { - yield point - } } /** diff --git a/packages/client/test/unit/util/point.test.ts b/packages/client/test/unit/util/point.test.ts index d91310bd..a4f56fc3 100644 --- a/packages/client/test/unit/util/point.test.ts +++ b/packages/client/test/unit/util/point.test.ts @@ -4,6 +4,7 @@ import {Point, PointValues, convertTime} from '../../../src' describe('point', () => { it('creates point with various fields', () => { const point = Point.measurement('blah') + .setMeasurement('') .setBooleanField('truthy', true) .setBooleanField('falsy', false) .setIntegerField('intFromString', '20')