Members
attributes
Attributes of a model, for which methods will be defined
Example
import Model, { Attr } from 'active-redux';
const Person = Model.define('people', class Person {
static attributes = {
name: Attr.string(),
}
});
const joe = new Person({ attributes: { name: "Joe" } });
joe.name // => "Joe"
Methods
(static) all() → {Promise.<Array.<this>>}
Gets all of that resource
Returns:
- Type:
-
Promise.<Array.<this>>
Array of model instances
Example
Person.all()
// => Promise<Array<Person>>
(static) find(query, optionsopt) → {Promise.<(this|null)>}
Gets one of that resource
Parameters:
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
query |
Object
|
Query for the store | |||||||||
options |
Object
|
<optional> |
|
Returns:
- Type:
-
Promise.<(this|null)>
A model instance
Example
Person.find({ id: 5 })
// => Promise<Person>
(static) where(query, optionsopt) → {Promise.<Array.<this>>}
Queries the store for that resource
Parameters:
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
query |
Object
|
Query for the store | |||||||||
options |
Object
|
<optional> |
|
Returns:
- Type:
-
Promise.<Array.<this>>
Array of model instances
Example
Person.where({ name: "Joe" })
// => Promise<Array<Person>>