Builder
|
Builder |
18 |
gets the first result from the current query
|
Builder#first |
|
gets the first result, or throws if no results
|
Builder#firstOrFail |
|
sugar for finding models by primary key
|
- |
4 |
can fetch a single model from :endpoint/:id
|
Builder#find |
|
defers to findMany() if an array is given to find()
|
Builder#find |
|
can fetch multiple models using whereIn
|
Builder#findMany |
|
throws if no model was found
|
Builder#findOrFail |
|
when you want a partial result
|
- |
2 |
can get a single column's value from the first row
|
Builder#value |
|
can get an array of values from a column
|
Builder#lists |
|
underling model instance
|
Builder#_getModel |
3 |
has a setter and getter
|
- |
|
is the source of scope methods copied to the builder
|
- |
|
hydrates data returned from a SELECT query
|
- |
|
scope()
|
Builder#scope |
2 |
tracks calls to dynamic scope methods
|
- |
|
is chainable
|
- |
|
query execution
|
- |
4 |
defers to connection.read for SELECT queries
|
Builder#get |
|
defers to connection.create for INSERT queries
|
Builder#insert |
|
defers to connection.update for UPDATE queries
|
Builder#update |
|
defers to connection.update for DELETE queries
|
Builder#delete |
|
methods without client-side implementation
|
- |
1 |
test/BuilderTest.js |
- |
|
Container
|
Container |
3 |
registers a model definition
|
- |
|
makes a previously registered model
|
- |
|
throws if asked to make an unregistered model
|
- |
|
default export
|
- |
11 |
factory
|
- |
5 |
defines a model
|
- |
|
returns a previously defined model
|
- |
|
attaches model definitions to itself
|
- |
|
makes models independent of each other
|
- |
|
boots each model
|
- |
|
api
|
- |
6 |
fetches a record by ID
|
- |
|
returns a collection of hydrated models
|
- |
|
applies the current JSON-encoded query to the endpoint URL
|
- |
|
lists a given column
|
- |
|
updates a model
|
- |
|
deletes a model
|
- |
|
Model
|
Model |
45 |
can fetch all models
|
Model#all |
|
updates the model attributes and saves it
|
Model#update |
|
deletes the model
|
Model#delete |
|
data
|
- |
10 |
is made available as public properties
|
- |
|
can be retreived as plain object
|
Model#getAttributes |
|
can be changed
|
Model#setAttributes |
|
tracks any changes
|
Model#getDirty |
|
fills the model from an attributes object
|
Model#fill |
|
when the column is a date
|
- |
5 |
is cast to a Date object
|
- |
|
does not cast to Date if null
|
- |
|
can be configured at run-time on the class object
|
- |
|
is cloned
|
- |
|
is cast to a UNIX timestamp when converted to JSON
|
- |
|
query builder
|
- |
3 |
can be created from a model instance
|
Model#newQuery |
|
can be created from a model class (statically)
|
Model#query |
|
has its methods proxied at boot
|
- |
|
hydrate()
|
Model#hydrate |
1 |
creates an array of models from an array of plain objects
|
- |
|
boot()
|
Model#boot |
5 |
is called once per model
|
- |
|
scoped method
|
- |
4 |
is added to the class
|
- |
|
is added to the prototype
|
- |
|
returns a builder object
|
- |
|
calls scope() on the builder
|
- |
|
create()
|
Model#create |
1 |
news up an instance with the given attributes and saves it
|
- |
|
save()
|
Model#save |
4 |
on a non-existent model
|
- |
2 |
calls insert() on the query builder
|
- |
|
updates the instance to include new attributes from the server
|
- |
|
on an existing model
|
- |
2 |
calls update() on the connection
|
- |
|
updates the instance to include new attributes from the server
|
- |
|
eventing
|
- |
11 |
test/ModelTest.js |
- |
|
can have any number of observers
|
- |
|
when a new model is created
|
- |
3 |
fires the creating event beforehand
|
- |
|
cancels the creation if event handler returns false
|
- |
|
fires the created event afterwards
|
- |
|
whenever a model is saved
|
- |
2 |
fires the saving event beforehand
|
- |
|
fires the saved event afterwards
|
- |
|
when a model is updated
|
- |
2 |
fires the updating event beforehand
|
- |
|
fires the updated event afterwards
|
- |
|
when a model is deleted
|
- |
2 |
fires the deleting event beforehand
|
- |
|
fires the deleted event afterwards
|
- |
|
relationships
|
- |
7 |
does not include relations in getAttributes / getDirty
|
- |
|
eager loading
|
Model#load |
6 |
resolves with the original model
|
- |
|
attaches the returned attributes to the model
|
- |
|
does not clobber dirty attributes
|
- |
|
hydrates the correct model for a [*]Many relation
|
- |
|
hydrates the correct model for a [*]One relation
|
- |
|
can load multiple relations at the same time
|
- |
|
RestConnection
|
- |
11 |
requires an endpoint (URL)
|
- |
|
read
|
RestConnection#read |
3 |
sends GET requests to the endpoint
|
- |
|
can fetch by id
|
- |
|
passes the current query in a JSON-encoded query-string parameter
|
- |
|
create()
|
RestConnection#create |
1 |
makes a POST request with a body of JSONified data
|
- |
|
update()
|
RestConnection#update |
3 |
makes a PUT request
|
- |
|
can update by id
|
- |
|
passes the current query in a JSON-encoded GET parameter
|
- |
|
delete()
|
RestConnection#delete |
3 |
makes a DELETE request
|
- |
|
can delete by id
|
- |
|
passes the current query in a JSON-encoded GET parameter
|
- |
|