QRY_Condition.DateLiteral
Class
global inherited sharing class QRY_Condition.DateLiteral implements QRY_Condition.EvaluableImplements: QRY_Condition.Evaluable
Provides SOQL date literal values for use in QRY_Builder conditions. Implements Evaluable so date literals can be passed as condition values to FieldCondition and through the QRY_Builder fluent API. Date literals are special SOQL keywords (TODAY, LAST_N_DAYS:30, etc.) that represent relative date/time ranges and cannot be expressed as bind variables.
Since: 1.0
Example:
// Records created in the last 30 days
List<Account> accounts = QRY_Builder.selectFrom(Account.SObjectType)
.condition('CreatedDate').equals(new QRY_Condition.DateLiteral().lastNDays(30))
.toList();
// Records created today
List<Account> accounts = QRY_Builder.selectFrom(Account.SObjectType)
.condition('CreatedDate').equals(new QRY_Condition.DateLiteral().today())
.toList();Methods
| Method | Description |
|---|---|
| global QRY_Condition.DateLiteral last(Integer numberOfUnits, QRY_Condition.UnitOfTime unit) | Sets the date literal to LAST_N_*:n. |
| global QRY_Condition.DateLiteral last(QRY_Condition.UnitOfTime unit) | Sets the date literal to LAST_* for a given unit (e.g., LAST_QUARTER). |
| global QRY_Condition.DateLiteral last90Days() | Sets the date literal to LAST_90_DAYS. |
| global QRY_Condition.DateLiteral lastNDays(Integer numberOfDays) | Sets the date literal to LAST_N_DAYS:n. |
| global QRY_Condition.DateLiteral next(Integer numberOfUnits, QRY_Condition.UnitOfTime unit) | Sets the date literal to NEXT_N_*:n. |
| global QRY_Condition.DateLiteral next(QRY_Condition.UnitOfTime unit) | Sets the date literal to NEXT_* for a given unit (e.g., NEXT_QUARTER). |
| global QRY_Condition.DateLiteral next90Days() | Sets the date literal to NEXT_90_DAYS. |
| global QRY_Condition.DateLiteral nextNDays(Integer numberOfDays) | Sets the date literal to NEXT_N_DAYS:n. |
| global QRY_Condition.DateLiteral thisUnit(QRY_Condition.UnitOfTime unit) | Sets the date literal to a THIS_* value for the given unit. |
| global QRY_Condition.DateLiteral today() | Sets the date literal to TODAY. |
| global QRY_Condition.DateLiteral tomorrow() | Sets the date literal to TOMORROW. |
| global QRY_Condition.DateLiteral yesterday() | Sets the date literal to YESTERDAY. |
Method Details
last
global QRY_Condition.DateLiteral last(Integer numberOfUnits, QRY_Condition.UnitOfTime unit)Sets the date literal to LAST_N_*:n.
Parameters:
numberOfUnits(Integer) - The number of unitsunit(QRY_Condition.UnitOfTime) - The unit of time
Returns: QRY_Condition.DateLiteral - The DateLiteral instance for method chaining.
Since: 1.0
Example:
new QRY_Condition.DateLiteral().last(4, QRY_Condition.UnitOfTime.QUARTER)last
global QRY_Condition.DateLiteral last(QRY_Condition.UnitOfTime unit)Sets the date literal to LAST_* for a given unit (e.g., LAST_QUARTER).
Parameters:
unit(QRY_Condition.UnitOfTime) - The unit of time
Returns: QRY_Condition.DateLiteral - The DateLiteral instance for method chaining.
Since: 1.0
Example:
new QRY_Condition.DateLiteral().last(QRY_Condition.UnitOfTime.QUARTER)last90Days
global QRY_Condition.DateLiteral last90Days()Sets the date literal to LAST_90_DAYS.
Returns: QRY_Condition.DateLiteral - The DateLiteral instance for method chaining.
Since: 1.0
Example:
new QRY_Condition.DateLiteral().last90Days()lastNDays
global QRY_Condition.DateLiteral lastNDays(Integer numberOfDays)Sets the date literal to LAST_N_DAYS:n.
Parameters:
numberOfDays(Integer) - The number of days
Returns: QRY_Condition.DateLiteral - The DateLiteral instance for method chaining.
Since: 1.0
Example:
new QRY_Condition.DateLiteral().lastNDays(30)next
global QRY_Condition.DateLiteral next(Integer numberOfUnits, QRY_Condition.UnitOfTime unit)Sets the date literal to NEXT_N_*:n.
Parameters:
numberOfUnits(Integer) - The number of unitsunit(QRY_Condition.UnitOfTime) - The unit of time
Returns: QRY_Condition.DateLiteral - The DateLiteral instance for method chaining.
Since: 1.0
Example:
new QRY_Condition.DateLiteral().next(2, QRY_Condition.UnitOfTime.FISCAL_YEAR)next
global QRY_Condition.DateLiteral next(QRY_Condition.UnitOfTime unit)Sets the date literal to NEXT_* for a given unit (e.g., NEXT_QUARTER).
Parameters:
unit(QRY_Condition.UnitOfTime) - The unit of time
Returns: QRY_Condition.DateLiteral - The DateLiteral instance for method chaining.
Since: 1.0
Example:
new QRY_Condition.DateLiteral().next(QRY_Condition.UnitOfTime.QUARTER)next90Days
global QRY_Condition.DateLiteral next90Days()Sets the date literal to NEXT_90_DAYS.
Returns: QRY_Condition.DateLiteral - The DateLiteral instance for method chaining.
Since: 1.0
Example:
new QRY_Condition.DateLiteral().next90Days()nextNDays
global QRY_Condition.DateLiteral nextNDays(Integer numberOfDays)Sets the date literal to NEXT_N_DAYS:n.
Parameters:
numberOfDays(Integer) - The number of days
Returns: QRY_Condition.DateLiteral - The DateLiteral instance for method chaining.
Since: 1.0
Example:
new QRY_Condition.DateLiteral().nextNDays(60)thisUnit
global QRY_Condition.DateLiteral thisUnit(QRY_Condition.UnitOfTime unit)Sets the date literal to a THIS_* value for the given unit.
Parameters:
unit(QRY_Condition.UnitOfTime) - The unit of time
Returns: QRY_Condition.DateLiteral - The DateLiteral instance for method chaining.
Since: 1.0
Example:
new QRY_Condition.DateLiteral().thisUnit(QRY_Condition.UnitOfTime.MONTH)
new QRY_Condition.DateLiteral().thisUnit(QRY_Condition.UnitOfTime.DAY) // returns TODAYtoday
global QRY_Condition.DateLiteral today()Sets the date literal to TODAY.
Returns: QRY_Condition.DateLiteral - The DateLiteral instance for method chaining.
Since: 1.0
Example:
new QRY_Condition.DateLiteral().today()tomorrow
global QRY_Condition.DateLiteral tomorrow()Sets the date literal to TOMORROW.
Returns: QRY_Condition.DateLiteral - The DateLiteral instance for method chaining.
Since: 1.0
Example:
new QRY_Condition.DateLiteral().tomorrow()yesterday
global QRY_Condition.DateLiteral yesterday()Sets the date literal to YESTERDAY.
Returns: QRY_Condition.DateLiteral - The DateLiteral instance for method chaining.
Since: 1.0
Example:
new QRY_Condition.DateLiteral().yesterday()