tableMixIn

baja.coll. tableMixIn

Description:
  • A Mix-In for objects that are tables.

Source:

A Mix-In for objects that are tables.

Methods

(static) 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:
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
method's arguments.

Properties
Name Type Attributes Default Description
ok function <optional>

(Deprecated: use Promise) called when the
cursor has been created with the cursor as an argument.

fail function <optional>

(Deprecated: use Promise) called if the
cursor fails to be retrieved. An error is passed in as the first
argument.

batch baja.comm.Batch <optional>

if specified, the operation will be
batched into this object.

before function <optional>

called just before the Cursor is about to
be iterated through.

after function <optional>

called just after the Cursor has finished
iterating.

offset Number <optional>
0

Specifies the row number to start encoding
the result-set from.

limit Number <optional>
10

Specifies the maximum number of rows that
can be encoded.

Returns:

a promise that will be resolved once the cursor has
been retrieved.

Type
Promise

(static) getCol(column) → {module:baja/coll/Table.TableColumn}

Description:
  • Returns a column object for the given column name.

Source:
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.

Type
module:baja/coll/Table.TableColumn

(static) getColumns() → {Array.<module:baja/coll/Table.TableColumn>}

Description:
  • Returns an array of Table Columns.

Source:
See:
Returns:

an array of columns

Type
Array.<module:baja/coll/Table.TableColumn>

(static) hasConfig() → {Boolean}

Description:
  • Return true if the table has a configuration component.

Source:
Returns:

true if a config component is available.

Type
Boolean

(static) 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:
Parameters:
Name Type Attributes Description
obj Object <optional>

optional object literal parameters.

Properties
Name Type Attributes Description
ok function <optional>

(Deprecated: use Promise) the ok callback.
This function is called once the parameters have been resolved.

fail function <optional>

(Deprecated: use Promise) the fail callback.
This function is called once the parameters have failed to resolve.

Returns:

promise that resolves to a config
Component.

Type
Promise.<baja.Component>