Home Reference Source Test Repository

Test

Description Identifier Count

gets the first result from the current query

Builder#first

gets the first result, or throws if no results

Builder#firstOrFail

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

can get a single column's value from the first row

Builder#value

can get an array of values from a column

Builder#lists

has a setter and getter

-

is the source of scope methods copied to the builder

-

hydrates data returned from a SELECT query

-

tracks calls to dynamic scope methods

-

is chainable

-

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
test/BuilderTest.js -

registers a model definition

-

makes a previously registered model

-

throws if asked to make an unregistered model

-

defines a model

-

returns a previously defined model

-

attaches model definitions to itself

-

makes models independent of each other

-

boots each model

-

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

-

can fetch all models

Model#all

updates the model attributes and saves it

Model#update

deletes the model

Model#delete

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

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

-

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

-

creates an array of models from an array of plain objects

-

is called once per model

-

is added to the class

-

is added to the prototype

-

returns a builder object

-

calls scope() on the builder

-

news up an instance with the given attributes and saves it

-

calls insert() on the query builder

-

updates the instance to include new attributes from the server

-

calls update() on the connection

-

updates the instance to include new attributes from the server

-
test/ModelTest.js -

can have any number of observers

-

fires the creating event beforehand

-

cancels the creation if event handler returns false

-

fires the created event afterwards

-

fires the saving event beforehand

-

fires the saved event afterwards

-

fires the updating event beforehand

-

fires the updated event afterwards

-

fires the deleting event beforehand

-

fires the deleted event afterwards

-

does not include relations in getAttributes / getDirty

-

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

-

requires an endpoint (URL)

-

sends GET requests to the endpoint

-

can fetch by id

-

passes the current query in a JSON-encoded query-string parameter

-

makes a POST request with a body of JSONified data

-

makes a PUT request

-

can update by id

-

passes the current query in a JSON-encoded GET parameter

-

makes a DELETE request

-

can delete by id

-

passes the current query in a JSON-encoded GET parameter

-