mirror of
https://github.com/silverqx/TinyORM.git
synced 2026-05-23 10:51:02 -05:00
added missing raw methods
or/whereRaw(), groupByRaw(), or/havingRaw(), orderByRaw(). - added docs - tested manually in Playground
This commit is contained in:
@@ -342,6 +342,12 @@ namespace Relations
|
||||
/*! Add an "or where not null" clause to the query. */
|
||||
Builder &orWhereNotNull(const Column &column);
|
||||
|
||||
/*! Add a raw "where" clause to the query. */
|
||||
Builder &whereRaw(const QString &sql, const QVector<QVariant> &bindings = {},
|
||||
const QString &condition = "and");
|
||||
/*! Add a raw "or where" clause to the query. */
|
||||
Builder &orWhereRaw(const QString &sql, const QVector<QVariant> &bindings = {});
|
||||
|
||||
/*! Add a "group by" clause to the query. */
|
||||
Builder &groupBy(const QVector<Column> &groups);
|
||||
/*! Add a "group by" clause to the query. */
|
||||
@@ -350,6 +356,9 @@ namespace Relations
|
||||
template<ColumnConcept ...Args>
|
||||
Builder &groupBy(Args &&...groups);
|
||||
|
||||
/*! Add a raw "groupBy" clause to the query. */
|
||||
Builder &groupByRaw(const QString &sql, const QVector<QVariant> &bindings = {});
|
||||
|
||||
/*! Add a "having" clause to the query. */
|
||||
Builder &having(const Column &column, const QString &comparison,
|
||||
const QVariant &value, const QString &condition = "and");
|
||||
@@ -357,11 +366,20 @@ namespace Relations
|
||||
Builder &orHaving(const Column &column, const QString &comparison,
|
||||
const QVariant &value);
|
||||
|
||||
/*! Add a raw "having" clause to the query. */
|
||||
Builder &havingRaw(const QString &sql, const QVector<QVariant> &bindings = {},
|
||||
const QString &condition = "and");
|
||||
/*! Add a raw "or having" clause to the query. */
|
||||
Builder &orHavingRaw(const QString &sql, const QVector<QVariant> &bindings = {});
|
||||
|
||||
/*! Add an "order by" clause to the query. */
|
||||
Builder &orderBy(const Column &column, const QString &direction = "asc");
|
||||
/*! Add a descending "order by" clause to the query. */
|
||||
Builder &orderByDesc(const Column &column);
|
||||
|
||||
/*! Add a raw "order by" clause to the query. */
|
||||
Builder &orderByRaw(const QString &sql, const QVector<QVariant> &bindings = {});
|
||||
|
||||
/*! Add an "order by" clause for a timestamp to the query. */
|
||||
Builder &latest(const Column &column = "");
|
||||
/*! Add an "order by" clause for a timestamp to the query. */
|
||||
@@ -1380,6 +1398,23 @@ namespace Relations
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename Model>
|
||||
Builder<Model> &
|
||||
Builder<Model>::whereRaw(const QString &sql, const QVector<QVariant> &bindings,
|
||||
const QString &condition)
|
||||
{
|
||||
toBase().whereRaw(sql, bindings, condition);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename Model>
|
||||
Builder<Model> &
|
||||
Builder<Model>::orWhereRaw(const QString &sql, const QVector<QVariant> &bindings)
|
||||
{
|
||||
toBase().whereRaw(sql, bindings, QStringLiteral("or"));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename Model>
|
||||
Builder<Model> &Builder<Model>::groupBy(const QVector<Column> &groups)
|
||||
{
|
||||
@@ -1402,6 +1437,14 @@ namespace Relations
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename Model>
|
||||
Builder<Model> &
|
||||
Builder<Model>::groupByRaw(const QString &sql, const QVector<QVariant> &bindings)
|
||||
{
|
||||
toBase().groupByRaw(sql, bindings);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename Model>
|
||||
Builder<Model> &
|
||||
Builder<Model>::having(const Column &column, const QString &comparison,
|
||||
@@ -1420,6 +1463,23 @@ namespace Relations
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename Model>
|
||||
Builder<Model> &
|
||||
Builder<Model>::havingRaw(const QString &sql, const QVector<QVariant> &bindings,
|
||||
const QString &condition)
|
||||
{
|
||||
toBase().havingRaw(sql, bindings, condition);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename Model>
|
||||
Builder<Model> &
|
||||
Builder<Model>::orHavingRaw(const QString &sql, const QVector<QVariant> &bindings)
|
||||
{
|
||||
toBase().havingRaw(sql, bindings, QStringLiteral("or"));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename Model>
|
||||
Builder<Model> &
|
||||
Builder<Model>::orderBy(const Column &column, const QString &direction)
|
||||
@@ -1435,6 +1495,14 @@ namespace Relations
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename Model>
|
||||
Builder<Model> &Builder<Model>::orderByRaw(const QString &sql,
|
||||
const QVector<QVariant> &bindings)
|
||||
{
|
||||
toBase().orderByRaw(sql, bindings);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename Model>
|
||||
Builder<Model> &
|
||||
Builder<Model>::latest(const Column &column)
|
||||
|
||||
Reference in New Issue
Block a user