From 6e7dc502d2abdac10eec8d4d82dbe6efca202c6a Mon Sep 17 00:00:00 2001 From: Julien Le Coupanec Date: Mon, 27 Apr 2020 23:07:31 +0200 Subject: [PATCH] docs(adonis): initialize query builder section --- backend/adonis.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/backend/adonis.js b/backend/adonis.js index 7b7594d..2ba0e6c 100644 --- a/backend/adonis.js +++ b/backend/adonis.js @@ -277,6 +277,38 @@ instance.merge(jsonAttributes) // Modifies the specified attribute instance.save() // Save the instance to the database. instance.delete() // Delete model instance from the database. +/******************************************************************************************** +* QUERY BUILDER +* https://adonisjs.com/docs/query-builder +* http://knexjs.org/ +********************************************************************************************/ + +const Database = use('Database') + +// Available where clauses + +where(~mixed~) +orWhere(~mixed~) +whereNot(~mixed~) +orWhereNot(~mixed~) +whereIn(column|columns, array|callback|builder) +orWhereIn(column | columns, array | callback | builder) +whereNotIn(column, array|callback|builder) +orWhereNotIn(column, array | callback | builder) +whereNull(column) +orWhereNull(column) +whereNotNull(column) +orWhereNotNull(column) +whereExists(builder | callback) +orWhereExists(builder | callback) +whereNotExists(builder | callback) +orWhereNotExists(builder | callback) +whereBetween(column, range) +orWhereBetween(column, range) +whereNotBetween(column, range) +orWhereNotBetween(column, range) +whereRaw(query, [bindings]) + /******************************************************************************************** * DATABASE HOOKS * https://adonisjs.com/docs/database-hooks