There are often times where you need to run multiple queries with the same WHERE conditions. In those cases, you can create a "filter" function which accepts a FieldResolver<T> and returns a ConditionalClause
SELECT
Id
FROM
Account
WHERE
Active__c = true
AND AccountSource = 'email'
AND AnnualRevenue > 100
LIMIT
1
SELECT
Id
FROM
Contact
WHERE
Account.Active__c = true
AND Account.AccountSource = 'email'
AND Account.AnnualRevenue > 100
LIMIT
1
SELECT
Id
FROM
Contact
WHERE
LeadSource = 'web'
AND (
Account.Active__c = true
AND Account.AccountSource = 'email'
AND Account.AnnualRevenue > 100
)
LIMIT
1