The Objection.js model.
Additional options for the controller.
OptionalsearchColumns to search in by default.
Applies multi-column ordering to an Objection or Knex query builder.
Accepts an object like { created_at: 'desc', 'user.name': 'asc' }.
user.name) are used as provided. Ensure related
tables have been joined via joinRelated or withGraphJoined.'asc'.Query builder instance to apply ordering to.
Mapping of column paths to sort direction.
Deletes records by ID(s).
The ID or IDs of records to delete.
OptionalqueryBuilder: anyOptional query builder instance.
The promise of the resulting data.
Deletes records based on where clause.
Criteria for delete operation.
OptionalqueryBuilder: anyOptional query builder instance.
The promise of the resulting data.
ProtectederrorFormats an error response object.
OptionalerrorObj: anyThe error object or message.
Optionalstatus: number = 500The HTTP status code.
Optionalcode: number = 0Additional status code.
The error response object.
Inserts one or multiple records.
The data to insert.
OptionalqueryBuilder: anyOptional query builder instance.
The promise of the resulting data.
ProtectedinsertMSSQL treats the primary key as an IDENTITY column and rejects explicit
values unless IDENTITY_INSERT is enabled. This runs flat inserts that
carry an explicit primary key as a single raw batch (the SET and the
INSERT must share the same round-trip on MSSQL), and returns null for
any other engine/shape so callers fall back to the normal insertGraph.
The record or records to insert.
The result, or null when the special handling does not apply.
Lists records based on search criteria.
The search criteria.
OptionalqueryBuilder: anyOptional query builder instance.
The promise of the resulting data.
Returns metadata information about the table.
The promise with table metadata.
Selects a record by its ID.
The ID or IDs to select.
OptionalqueryBuilder: anyOptional query builder instance.
The promise of the resulting data.
Selects one record by its name field.
Object containing the name parameter.
The name to search for.
OptionalqueryBuilder: anyOptional query builder instance.
The promise of the resulting data.
Selects one record based on given criteria without considering active state.
Criteria to find the record.
OptionalqueryBuilder: anyOptional query builder instance.
The promise of the resulting data.
Selects one active record based on given criteria.
Criteria to find the record.
OptionalqueryBuilder: anyOptional query builder instance.
The promise of the resulting data.
ProtectedsuccessFormats a successful response object.
Optionaldata: anyThe data to return in the response.
Optionalstatus: number = 200The HTTP status code.
Optionalcode: number = 0Additional status code.
The success response object.
ProtectedsuccessMerges additional data into a successful response object.
Optionaldata: anyThe data to return in the response.
Optionalstatus: number = 200The HTTP status code.
Optionalcode: number = 0Additional status code.
The merged success response object.
Updates records using an upsert operation.
The data for upsert.
OptionalqueryBuilder: anyOptional query builder instance.
The promise of the resulting data.
Controller
Description
A controller class for handling database queries using Objection.js models.