Paste a SOQL query and see it translated to SOQL Lib as you type. Every clause β sub-queries, nested conditions, aggregates, sorting and paging β is parsed and mapped to the matching builder method.
SOQL.of(Account.SObjectType)
.with(Account.Id, Account.Name, Account.Industry)
.with('Owner', User.Name)
.whereAre(SOQL.FilterGroup
.add(SOQL.Filter.with(Account.Industry).equal('Technology'))
.add(SOQL.FilterGroup
.add(SOQL.Filter.with(Account.BillingCity).equal('San Francisco'))
.add(SOQL.Filter.with(Account.BillingCity).equal('New York'))
.anyConditionMatching()
)
.add(SOQL.Filter.with(Account.NumberOfEmployees).greaterThan(100))
)
.orderBy(Account.Name)
.setLimit(10)
.toList();
| SOQL | SOQL Lib | Docs |
|---|---|---|
SELECT Id, Name | .with(Account.Id, Account.Name) | API |
SELECT Owner.Name | .with('Owner', User.Name) | API |
(SELECT Id FROM Contacts) | .with(SOQL.SubQuery.of('Contacts')β¦) | API |
WHERE Name = :value | .whereAre(SOQL.Filter.name().equal(value)) | API |
AND / OR | SOQL.FilterGroup + .anyConditionMatching() | API |
LIKE '%v%' | .contains('v') | API |
IN (SELECT β¦) | .isIn(SOQL.InnerJoin.of(β¦)) | API |
GROUP BY / HAVING | .groupBy(β¦) + .have(SOQL.HavingFilterβ¦) | API |
ORDER BY x DESC NULLS LAST | .orderBy(β¦).sortDesc().nullsLast() | API |
LIMIT / OFFSET | .setLimit(n) / .offset(n) | API |
WITH SYSTEM_MODE | .systemMode() | API |
USING SCOPE MINE | .mineScope() | API |
Note: WITH USER_MODE is the SOQL Lib default, so it produces no extra method call. Values become bind variables, which is why the generated query is safe against SOQL injection. See the full documentation for everything the builder supports.