db.Index Extends
Creates an IDBIndex wrapper object. Indexes are associated with object stores and provide methods for looking up objects based on their non-key properties. Should not be created directly, access through the object store it belongs to.

Inheritance

Constructor

goog.db.Index(index)

Parameters

index : !IDBIndex
Underlying IDBIndex object.

Instance Methods

Public Protected Private
Defined in goog.db.Index
get(key) !goog.async.Deferred
Fetches a single object from the object store. Even if there are multiple objects that match the given key, this method will get only one of them.
Arguments:
key : IDBKeyType
Key to look up in the index.
Returns: !goog.async.Deferred  The deferred object for the given record.
code »
getAll(opt_key) !goog.async.Deferred
Gets all indexed objects. If the key is provided, gets all indexed objects that match the key instead.
Arguments:
opt_key : IDBKeyType=
Key to look up in the index.
Returns: !goog.async.Deferred  A deferred array of objects that match the key.
code »
getAllKeys(opt_key) !goog.async.Deferred
Gets the keys to look up all the indexed objects. If the key is provided, gets all records for objects that match the key instead.
Arguments:
opt_key : IDBKeyType=
Key to look up in the index.
Returns: !goog.async.Deferred  A deferred array of keys for objects that match the key.
code »
getAll_(fnmsgopt_key) !goog.async.Deferred
Helper function for getAll and getAllKeys.
Arguments:
fn : string
Function name to call on the index to get the request.
msg : string
Message to give to the error.
opt_key : IDBKeyType=
Key to look up in the index.
Returns: !goog.async.Deferred  The resulting deferred array of objects.
code »
getKey(key) !goog.async.Deferred
Looks up a single object from the object store and gives back the key that it's listed under in the object store. Even if there are multiple records that match the given key, this method returns the first.
Arguments:
key : IDBKeyType
Key to look up in the index.
Returns: !goog.async.Deferred  The deferred key for the record that matches the key.
code »
getKeyPath() string
No description.
Returns: string  Key path of the index.
code »
getName() string
No description.
Returns: string  Name of the index.
code »
get_(fnmsgkey) !goog.async.Deferred
Helper function for get and getKey.
Arguments:
fn : string
Function name to call on the index to get the request.
msg : string
Message to give to the error.
key : IDBKeyType
The key to look up in the index.
Returns: !goog.async.Deferred  The resulting deferred object.
code »
isUnique() boolean
No description.
Returns: boolean  True if the index enforces that there is only one object for each unique value it indexes on.
code »
openCursor(opt_rangeopt_direction) !goog.db.Cursor
Opens a cursor over the specified key range. Returns a cursor object which is able to iterate over the given range. Example usage: var cursor = index.openCursor(goog.db.Range.bound('a', 'c')); var key = goog.events.listen( cursor, goog.db.Cursor.EventType.NEW_DATA, function() { // Do something with data. cursor.next(); }); goog.events.listenOnce( cursor, goog.db.Cursor.EventType.COMPLETE, function() { // Clean up listener, and perform a finishing operation on the data. goog.events.unlistenByKey(key); });
Arguments:
opt_range : !goog.db.KeyRange=
The key range. If undefined iterates over the whole object store.
opt_direction : !goog.db.Cursor.Direction=
The direction. If undefined moves in a forward direction with duplicates.
Returns: !goog.db.Cursor  The cursor.
code »

Instance Properties

Defined in goog.db.Index
index_ :
Underlying IndexedDB index object.
Code »

Package db

Package Reference