new Table()
- Description:
Represents a
baja:ITablein BajaScript.Tables are usually returned as the result of resolving an ORD (i.e. a BQL query).
- Source:
- Mixes In:
- See:
Members
(static) DEFAULT :baja.coll.Table
- Description:
Default
Tableinstance.
- Source:
Default Table instance.
Type:
Methods
cursor(obj) → {Promise}
- Description:
Iterate through a Table.
Please note, this may retrieve data asynchronously.
A callback function is passed in to retrieve the Cursor.
- Source:
- Mixes In:
- See:
Example
myTable.cursor({
each: function () {
// Called for each item in the Cursor...
var dataFromCursor = this.get();
}
})
.then(function (cursor) {
// Called once we have the Cursor
})
.catch(function (err) {
// Called if any errors in getting data
});
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
obj |
Object | function | the object literal that specifies the Properties
|
Returns:
a promise that will be resolved once the cursor has
been retrieved.
- Type
- Promise
getCol(column) → {module:baja/coll/Table.TableColumn}
- Description:
Returns a column object for the given column name.
- Source:
- Mixes In:
Parameters:
| Name | Type | Description |
|---|---|---|
column |
String | Number | the column name or index. |
Returns:
the table column or null
if the column can't be found.
getColumns() → {Array.<module:baja/coll/Table.TableColumn>}
- Description:
Returns an array of Table Columns.
- Source:
- Mixes In:
- See:
Returns:
an array of columns
- Type
- Array.<module:baja/coll/Table.TableColumn>
hasConfig() → {Boolean}
- Description:
Return true if the table has a configuration component.
- Source:
- Mixes In:
Returns:
true if a config component is available.
- Type
- Boolean
toConfig(objopt) → {Promise.<baja.Component>}
- Description:
Returns a promise that's used to access a Component that contains all the
table's configuration data. In the case of a History, the Component will
be a 'history:HistoryConfig' Component. For other types of query, this
may change in the future.
- Source:
- Mixes In:
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
obj |
Object |
<optional> |
optional object literal parameters. Properties
|
Returns:
promise that resolves to a config
Component.
- Type
- Promise.<baja.Component>
toString(cxopt) → {Promise.<String>|String}
- Description:
Resolves to the string value of the given table's actual TypeSpec from the
table's config if context is provided.If no context provided, this will return the string value of the type
registered on this table class. This will be abox:BoxTabletype.
- Source:
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
cx |
Object |
<optional> |