Skip to content

Commit

Permalink
chore: simplify queryPoints
Browse files Browse the repository at this point in the history
  • Loading branch information
bednar committed Sep 19, 2023
1 parent 29ed883 commit 095a51c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/client/src/InfluxDBClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<PointValues, void, void> {
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
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions packages/client/test/unit/util/point.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 095a51c

Please sign in to comment.