Skip to content

v2.2.0

Choose a tag to compare

@pgajek2 pgajek2 released this 08 Aug 20:12
· 134 commits to main since this release
11c436d

08-August-2023

Changes

Control condition order for main filters group

You can now specify the order for conditions used in separated whereAre clauses.
Previously, this was only possible using the new FilterGroup.

Use anyConditionMatching() or conditionLogic(String order).

SOQL.of(Account.SObjectType)
     .whereAre(SOQL.Filter.with(Account.Name).equal('Test'))
     .whereAre(SOQL.Filter.with(Account.Industry).equal('IT'))
     .conditionLogic('1 OR 2')
     .toList();

Documentation Update

Check out the updated documentation at:

https://soql-lib.vercel.app/api/soql

The list of all methods is now placed at the top of the concrete API page.

Date Literals

Date Literals cannot be bound. To skip binding, we have created the asDateLiteral() method, which notifies the library that the filter contains a Date Literal.

After an in-depth analysis of possible implementations, we decided to introduce this new method to handle Date Literals.

SOQL.of(Account.SObjectType) 
     .whereAre(SOQL.Filter.with(Account.CreatedDate).greaterThan('LAST_N_QUARTERS:2').asDateLiteral())
     .toList();

Filter Group Refactoring

FilterGroup now uses String.format to build conditions, offering a simpler and more efficient solution.

New Filter methods

Author: @salberski

Several new methods have been created:

notContains

SELECT Id
FROM Account
WHERE NOT Name LIKE '%My%'
SOQL.of(Contact.SObjectType)
    .whereAre(SOQL.Filter.name().notContains('My'))
    .toList();

SOQL.of(Contact.SObjectType)
    .whereAre(SOQL.Filter.name().notContains('_', 'My', '%'))
    .toList();

notEndsWith

SELECT Id
FROM Account
WHERE NOT Name LIKE '%My'
SOQL.of(Contact.SObjectType)
    .whereAre(SOQL.Filter.name().notEndsWith('My'))
    .toList();

notStartsWith

SELECT Id
FROM Account
WHERE NOT Name LIKE 'My%'
SOQL.of(Contact.SObjectType)
    .whereAre(SOQL.Filter.name().notStartsWith('My'))
    .toList();