new Table()
Represents a baja:ITable in BajaScript.
Tables are usually returned as the result of resolving an ORD (i.e. a BQL query).
Members
-
<static> DEFAULT :baja.coll.Table
-
Default
Tableinstance.Type:
Methods
-
cursor(obj)
-
Iterate through a Table.
Please note, this may retrieve data asynchronously.
A callback function is passed in to retrieve the Cursor.
Parameters:
Name Type Description objObject | function the object literal that specifies the
method's arguments.Properties
Name Type Argument Default Description okfunction <optional>
(Deprecated: use Promise) called when the
cursor has been created with the cursor as an argument.failfunction <optional>
(Deprecated: use Promise) called if the
cursor fails to be retrieved. An error is passed in as the first
argument.batchbaja.comm.Batch <optional>
if specified, the operation will be
batched into this object.beforefunction <optional>
called just before the Cursor is about to
be iterated through.afterfunction <optional>
called just after the Cursor has finished
iterating.offsetNumber <optional>
0 Specifies the row number to start encoding
the result-set from.limitNumber <optional>
10 Specifies the maximum number of rows that
can be encoded.- Mixes In:
- See:
Returns:
a promise that will be resolved once the cursor has
been retrieved.- Type
- Promise
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 }); -
getCol(column)
-
Returns a column object for the given column name.
Parameters:
Name Type Description columnString | Number the column name or index.
- Mixes In:
Returns:
the table column or null
if the column can't be found. -
getColumns()
-
Returns an array of Table Columns.
- Mixes In:
- See:
Returns:
an array of columns
- Type
- Array.<module:baja/coll/Table.TableColumn>
-
hasConfig()
-
Return true if the table has a configuration component.
- Mixes In:
Returns:
true if a config component is available.
- Type
- Boolean
-
toConfig( [obj])
-
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.Parameters:
Name Type Argument Description objObject <optional>
optional object literal parameters.
Properties
Name Type Argument Description okfunction <optional>
(Deprecated: use Promise) the ok callback.
This function is called once the parameters have been resolved.failfunction <optional>
(Deprecated: use Promise) the fail callback.
This function is called once the parameters have failed to resolve.- Mixes In:
Returns:
promise that resolves to a config
Component.- Type
- Promise.<baja.Component>
-
toString( [cx])
-
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.Parameters:
Name Type Argument Description cxObject <optional>
Returns: