public inherited sharing class AccountSelector {
public static SOQL Query {
get {
return SOQL.of(Account.sObjectType)
.with(new List<sObjectField>{
Account.Id,
Account.Name
});
}
}
}
public with sharing class MyController {
public static List<Account> getByIdOrName(Id accountId, String accountName) {
return AccountSelector.Query
.whereAre(SOQL.FiltersGroup
.add(SOQL.Filter.with(Account.Id).equal(accountId))
.add(SOQL.Filter.with(Account.Name).likeAny(accountName))
.conditionLogic('1 OR 2')
)
.asList();
}
}