From dd77070a91d0c52018b504311f0a0709dd259895 Mon Sep 17 00:00:00 2001 From: Piotr PG Gajek Date: Sat, 28 Sep 2024 09:33:18 +0200 Subject: [PATCH] Having Draft Signed-off-by: Piotr PG Gajek --- force-app/main/default/classes/SOQL.cls | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/force-app/main/default/classes/SOQL.cls b/force-app/main/default/classes/SOQL.cls index e95a275..1c6048f 100644 --- a/force-app/main/default/classes/SOQL.cls +++ b/force-app/main/default/classes/SOQL.cls @@ -115,6 +115,8 @@ public virtual inherited sharing class SOQL implements Queryable { Queryable groupByRollup(String relationshipName, SObjectField field); Queryable groupByCube(SObjectField field); Queryable groupByCube(String relationshipName, SObjectField field); + // HAVING + Queryable have(); // ORDER BY Queryable orderBy(String field); Queryable orderBy(String field, String direction); @@ -603,6 +605,10 @@ public virtual inherited sharing class SOQL implements Queryable { return this; } + public SOQL have() { + return this; + } + public SOQL orderBy(String field) { builder.orderBys.newOrderBy().with(field); return this; @@ -1691,6 +1697,18 @@ public virtual inherited sharing class SOQL implements Queryable { } } + private virtual class SoqlHavingGroup implements QueryClause { + public String buildNested() { + return ''; + } + } + + private class MainHavingGroup extends SoqlHavingGroup { + public override String toString() { + return 'HAVING ' + buildNested(); + } + } + private class SoqlOrderBy implements QueryClause { private String orderField; private String sortingOrder = 'ASC';