forked from bankyadam/not-so-bigquery
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (27 loc) · 1.13 KB
/
index.js
File metadata and controls
32 lines (27 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'use strict';
const BaseTableAction = require('../baseTableAction');
const TableDataListResponseObject = require('../../../entities/tableDataList/response');
/**
* Method: tabledata.list
*
* tabledata.list the content of a table in rows.
*
* @url https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/list
*
* @todo handle `startIndex` string
* Start row index of the table.
*
* @todo handle `formatOptions` object (DataFormatOptions)
* Output timestamp field value in usec int64 instead of double. Output format adjustments.
*/
class TablesDataAction extends BaseTableAction {
async perform() {
await this._tableShouldExist();
const maxResults = parseInt(this._req.query.maxResults, 10) || 100000;
const pageToken = this._req.query.pageToken || null;
// const selectedFields = this._req.query.selectedFields
const { data, totalRows, nextPageToken, fields } = await this._table.getData({ maxResults, pageToken });
return new TableDataListResponseObject(data, totalRows, nextPageToken, fields);
}
}
module.exports = TablesDataAction;