Skip to content

Commit 202f36d

Browse files
committed
where documentation
1 parent df7d280 commit 202f36d

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

website/docs/examples/where.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ sidebar_position: 6
66

77
Use [SOQL.FilterGroup](../api/soql-filters-group.md) and Use [SOQL.Filter](../api/soql-filter.md) to build your `WHERE` clause.
88

9+
Define basic filters in your Selector class.
10+
911
```sql
1012
SELECT Id, Name
1113
FROM Account
@@ -21,10 +23,37 @@ public inherited sharing class SOQL_Account extends SOQL implements SOQL.Selecto
2123
super(Account.SObjectType);
2224
with(Account.Id, Account.Name);
2325
}
26+
27+
public SOQL_Account byRecordType(String rt) {
28+
whereAre(Filter.recordType().equal(rt));
29+
return this;
30+
}
31+
32+
public SOQL_Account byIndustry(String industry) {
33+
with(Account.Industry)
34+
.whereAre(Filter.with(Account.Industry).equal(industry));
35+
return this;
36+
}
37+
38+
public SOQL_Account byParentId(Id parentId) {
39+
with(Account.ParentId)
40+
.whereAre(Filter.with(Account.ParentId).equal(parentId));
41+
return this;
42+
}
2443
}
2544
2645
public with sharing class MyController {
2746
47+
@AuraEnabled
48+
public static List<Account> getAccountsByRecordType(String recordType) {
49+
return SOQL_Account.query()
50+
.byRecordType(recordType)
51+
.byIndustry('IT')
52+
.with(Account.Industry, Account.AccountSource)
53+
.toList();
54+
}
55+
56+
@AuraEnabled
2857
public static List<Account> getByIdOrName(Id accountId, String accountName) {
2958
return SOQL_Account.query()
3059
.whereAre(SOQL.FilterGroup

0 commit comments

Comments
 (0)