The goog.db.Index Class

goog.db.Index(index)

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.

index {!IDBIndex}
Underlying IDBIndex object.
@see
goog.db.ObjectStore#getIndex

.get(value)

Fetches a single object from the object store. Even if there are multiple objects that match the given value, this method will get only one of them.

value {!Object}
Value to look up in the index.
returns {!goog.async.Deferred}
The deferred object that matches the value.

.getAll(opt_value)

Gets all indexed objects. If the value is provided, gets all indexed objects that match the value instead.

opt_value {!Object=}
Value to look up in the index.
returns {!goog.async.Deferred}
A deferred array of objects that match the value.

.getAllKeys(opt_value)

Gets the keys to look up all the indexed objects. If the value is provided, gets all keys for objects that match the value instead.

opt_value {!Object=}
Value to look up in the index.
returns {!goog.async.Deferred}
A deferred array of keys for objects that match the value.

.getKey(value)

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 objects that match the given value, this method will only get one of their keys.

value {!Object}
Value to look up in the index.
returns {!goog.async.Deferred}
The deferred key for the object that matches the value.

.getKeyPath()

returns {string}
Key path of the index.

.getName()

returns {string}
Name of the index.

.isUnique()

returns {boolean}
True if the index enforces that there is only one object for each unique value it indexes on.