Skip to content

Commit

Permalink
Add getTablesMeta / getTablesMetaAsync (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonvuri committed Mar 26, 2020
1 parent d03812e commit bfbc571
Show file tree
Hide file tree
Showing 4 changed files with 1,295 additions and 990 deletions.
44 changes: 44 additions & 0 deletions dist/browser-connector.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions dist/node-connector.js
Expand Up @@ -20712,6 +20712,17 @@ module.exports =
});
});
});
this.getTablesMetaAsync = this.handleErrors(function () {
return new Promise(function (resolve, reject) {
_this.getTablesMeta.bind(_this)(function (error, tables) {
if (error) {
reject(error);
} else {
resolve(tables);
}
});
});
});
this.getFieldsAsync = this.handleErrors(function (tableName) {
return new Promise(function (resolve, reject) {
_this.getFields(tableName, function (error, fields) {
Expand Down Expand Up @@ -21511,6 +21522,39 @@ module.exports =
* ...]
*/

}, {
key: "getTablesMeta",
value: function getTablesMeta(callback) {
this._client[0].get_tables_meta(this._sessionId[0], function (error, tables) {
if (error) {
callback(error);
} else {
callback(null, tables);
}
});
}

/**
* Get names and catalog metadata for tables that exist on the current session's connection.
* @return {Promise.<TTableMeta[]>} The list of objects containing table metadata.
*
* @example <caption>Get the list of tables with metadata from a connection:</caption>
*
* con.getTablesMetaAsync().then(res => console.log(res))
*
* [
* {
* table_name: 'my_table_name',
* col_datum_types: [TDatumType::BOOL, TDatumType::DOUBLE],
* col_names: ['bool_col', 'double_col'],
* is_view: false,
* is_replicated: false,
* shard_count: 0,
* max_rows: -1
* },
* ...]
*/

}, {
key: "getCompletionHints",

Expand Down

0 comments on commit bfbc571

Please sign in to comment.