Sync is the dispatcher for any database queries,
taking the "syncing" model
or collection
being queried, along with
a hash of options that are used in the various query methods.
If the transacting
option is set, the query is assumed to be
part of a transaction, and this information is passed along to Knex
.
Prefix all keys of the passed in object with the current table name
Select the first item from the database - only used by models.
Runs a select
query on the database, adding any necessary relational
constraints, resetting the query when complete. If there are results and
eager loaded relations, those are fetched and returned on the model before
the promise is resolved. Any success
handler passed in the
options will be called - used by both models & collections.
Inject all appropriate select costraints dealing with the relation
into the knex
query builder for the current instance.
Set the query builder on the options, in-case we need to
access in the fetching
event handlers.
Trigger a fetching
event on the model, and then select the appropriate columns.
Issues an insert
command on the query - only used by models.
Issues an update
command on the query - only used by models.
Issues a delete
command on the query.
Sync