LIMIT
Specify the maximum number of rows to return.
SELECT Id, Name
FROM Account
LIMIT 1000
public inherited sharing class AccountSelector implements SOQL.Selector {
public static SQOL query() {
return SQOL.of(Account.SObjectType)
.with(Account.Id, Account.Name);
}
}
public with sharing class MyController {
public static List<Account> getAccountsWithLimit() {
return AccountSelector.query()
.setLimit(1000)
.toList();
}
}