Last updated
Last updated
Understanding of is required for this article
Mandarine Query Language (MQL) serves as a helper to write queries. The main objective of MQL is to avoid the writing of SQL queries in your application's layer, and keep everything in a programatic environment. This is because, Mandarine.TS aims to respect principles & follow MVC patterns as well as making your code as simple and readable as possible.
Note that MQL is written inside
MQL makes use of a lexical processor that will transform the names of your repositories' methods in SQL & processable queries.
Will be transformed into
Operators are keywords that will tell the lexical processor what type of operation is being requested at a SQL level.
Currently, MQL only supports the operators
AND
OR
Definers are keywords that will shape your final SQL query. Definers are used for the lexical processor to identify what type of query is being or will be built.
findAll
: Select all rows
deleteAll
: Delete all rows in entity
countAll
: Count all rows in entity
findBy...
: Creates & executes a select query
countBy...
: Creates & executes a select count query
existsBy...
: Creates & executes a verification statement
deleteBy...
: Creates & executes a delete query
save
is part of a native method of a mandarine repository.
save
takes one argument which will be a object of your repository's model with the data to be inserted
Do use camel case
Do not use underscores, or other characters that may affect readability.
The names of your columns must match the name of your parameter in your repository method. Otherwise, query execution will fail.
Although, more operators are planned to be released. .
In order to add () information to your entity in your database, MQL allows you to do so by using save
Mandarine Query Language (MQL) is a sub-module of Mandarine's repositories. Although, MQL is considered an autonomous submodule.