Skip to content
This repository has been archived by the owner on Nov 9, 2024. It is now read-only.

Table Storage

pofallon edited this page Jan 17, 2012 · 19 revisions

require('bluesky').storage(options);

Returns a reference to 'storage' with the supplied options. Available options include:

  • account (required)
  • key (required)

Table-related storage methods ('static' methods)

storage.createTable(tableName, callback)

Creates a new table with the supplied tableName on this storage account. callback is passed a reference to the newly created table.

storage.listTables(callback)

Lists all tables in this storage account. Invokes callback with an array of table names.

storage.removeTable(tableName, callback)

Removes the table specified by tableName.

storage.table(tableName)

Returns a reference to a table (the same as returned by storage.createTable).


table.insert(partition, row, data, callback)

Inserts the key/value pairs specified in data into the table using the supplied partition and row keys. Boolean, Number, String and DateTime datatypes supported -- Number currently defaults to Edm.Double.

table.update(partition, row, data, options?, callback)

Replaces any existing data at the supplied partition and row keys with the values provided in data. Available options include:

  • upsert - When true, and no row currently exists at partition and row, the data will be inserted. Defaults to false.

table.del(partition, row, callback)

Removes the table data at the supplied partition and row keys.

table.fields(fieldArray)

Defines a subset of fields to be returned from a query, specified in fieldArray. Can be useful for performance and bandwidth purposes.

table.filter(criteria)

Applies a filter to the rows that will be returned from a query.

table.all(callback)

Applies any fields or filters and invokes callback with an array of the results.

table.forEach(callback, doneCallback)

Applies any fields or filters and invokes callback for each row in the results and (optionally) doneCallback with the count of rows when done. (Errors are sent to callback, or doneCallback if provided. Both callback and doneCallback expect 'err' as their first parameter.)

A Note about 'table' methods

filter and field are meant to be chained with all or forEach in a fluent API style, for example:

table.fields(['firstName','lastName']).filter({'state':'CA'}).forEach(callback, doneCallback);
Clone this wiki locally