dojo/store/DataStore (version 1.10)

dojo/store/api/Store

Summary

This is an adapter for using Dojo Data stores with an object store consumer. You can provide a Dojo data store and use this adapter to interact with it through the Dojo object store API

Usage

var foo = new DataStore(options);
dojo/store/DataStore
Parameter Type Description
options Object
Optional

This provides any configuration information that will be mixed into the store, including a reference to the Dojo data store under the property "store".

See the dojo/store/DataStore reference documentation for more information.

Property Summary

  • idPropertyThe object property to use to store the identity of the store items.
  • storeThe object store to convert to a data store
  • target

Method Summary

  • _objectConverter(callback)
  • add(object,options) Creates an object, throws an error if the object already exists
  • get(id,options) Retrieves an object by it's identity.
  • getChildren(parent,options) Retrieves the children of an object.
  • getIdentity(object) Fetch the identity for the given object.
  • getMetadata(object) Returns any metadata about the object.
  • put(object,options) Stores an object by its identity.
  • query(query,options) Queries the store for objects.
  • queryEngine(query,options) Defines the query engine to use for querying the data store
  • remove(id) Deletes an object by its identity.
  • transaction() Starts a new transaction.

Properties

idProperty
Defined by: dojo/store/DataStore

The object property to use to store the identity of the store items.

store
Defined by: dojo/store/DataStore

The object store to convert to a data store

target
Defined by: dojo/store/DataStore

Methods

_objectConverter(callback)
Parameter Type Description
callback undefined
Returns:function
add(object,options)

Creates an object, throws an error if the object already exists

Parameter Type Description
object Object

The object to store.

options dojo/store/api/Store.PutDirectives
Optional

Additional metadata for storing the data. Includes an "id" property if a specific id is to be used.

Returns:Number | undefined
get(id,options)

Retrieves an object by it's identity. This will trigger a fetchItemByIdentity

Parameter Type Description
id Object
Optional

The identity to use to lookup the object

options undefined
Returns:undefined
getChildren(parent,options)

Retrieves the children of an object.

Parameter Type Description
parent Object

The object to find the children of.

options dojo/store/api/Store.QueryOptions
Optional

Additional options to apply to the retrieval of the children.

A result set of the children of the parent object.

getIdentity(object)

Fetch the identity for the given object.

Parameter Type Description
object Object

The data object to get the identity from.

Returns:Number | undefined

The id of the given object.

getMetadata(object)

Returns any metadata about the object. This may include attribution, cache directives, history, or version information.

Parameter Type Description
object Object

The object to return metadata for.

Returns:Object

An object containing metadata.

put(object,options)

Stores an object by its identity.

Parameter Type Description
object Object

The object to store.

options Object
Optional

Additional metadata for storing the data. Includes a reference to an id that the object may be stored with (i.e. { id: "foo" }).

Returns:undefined
query(query,options)

Queries the store for objects.

Parameter Type Description
query Object

The query to use for retrieving objects from the store

options Object
Optional

Optional options object as used by the underlying dojo.data Store.

A query results object that can be used to iterate over results.

queryEngine(query,options)

Defines the query engine to use for querying the data store

Parameter Type Description
query Object

An object hash with fields that may match fields of items in the store. Values in the hash will be compared by normal == operator, but regular expressions or any object that provides a test() method are also supported and can be used to match strings by more complex expressions (and then the regex's or object's test() method will be used to match values).

options dojo/store/api/Store.QueryOptions
Optional

An object that contains optional information such as sort, start, and count.

Returns:Function | function

A function that caches the passed query under the field "matches". See any of the "query" methods on dojo.stores.

remove(id)

Deletes an object by its identity.

Parameter Type Description
id Object

The identity to use to delete the object

Returns:undefined
transaction()

Starts a new transaction. Note that a store user might not call transaction() prior to using put, delete, etc. in which case these operations effectively could be thought of as "auto-commit" style actions.

This represents the new current transaction.

Error in the documentation? Can’t find what you are looking for? Let us know!