Skip to main content

SOQL Lib Playground

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.

Examples
Basics
Relationships
Sub-queries
Filters
Condition logic
Aggregates
Sorting and paging
Advanced

SOQL Lib

βœ“ translated
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();

How clauses are mapped

SOQLSOQL LibDocs
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 / ORSOQL.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.