... | @@ -139,26 +139,66 @@ tsrange(LOWER("events"."period") - "events"."interval",UPPER("events"."period") |
... | @@ -139,26 +139,66 @@ tsrange(LOWER("events"."period") - "events"."interval",UPPER("events"."period") |
|
tsrange(LOWER("events"."period") - "events"."interval",UPPER("events"."period") + "events"."interval") && tsrange(left, right)
|
|
tsrange(LOWER("events"."period") - "events"."interval",UPPER("events"."period") + "events"."interval") && tsrange(left, right)
|
|
```
|
|
```
|
|
|
|
|
|
#### `:real_starting_after` as `.period_real_starting_after(value)`
|
|
#### `:real_starting_after` as `.period_real_starting_after(value)` **(ONLY WITH THRESHOLD)**
|
|
Filter records that the left value with the threshold is greater than the one provided, which can be either an Arel attribute or a plain value.
|
|
Filter records that the left value with the threshold is greater than the one provided, which can be either an Arel attribute or a plain value.
|
|
```
|
|
```
|
|
(LOWER("events"."period") - "events"."interval") > value
|
|
(LOWER("events"."period") - "events"."interval") > value
|
|
```
|
|
```
|
|
|
|
|
|
#### `:real_starting_before` as `.period_real_starting_before(value)`
|
|
#### `:real_starting_before` as `.period_real_starting_before(value)` **(ONLY WITH THRESHOLD)**
|
|
Filter records that the left value with the threshold is less than the one provided, which can be either an Arel attribute or a plain value.
|
|
Filter records that the left value with the threshold is less than the one provided, which can be either an Arel attribute or a plain value.
|
|
```
|
|
```
|
|
(LOWER("events"."period") - "events"."interval") < value
|
|
(LOWER("events"."period") - "events"."interval") < value
|
|
```
|
|
```
|
|
|
|
|
|
#### `:real_finishing_after` as `.period_real_finishing_after(value)`
|
|
#### `:real_finishing_after` as `.period_real_finishing_after(value)` **(ONLY WITH THRESHOLD)**
|
|
Filter records that the right value with the threshold is greater than the one provided, which can be either an Arel attribute or a plain value.
|
|
Filter records that the right value with the threshold is greater than the one provided, which can be either an Arel attribute or a plain value.
|
|
```
|
|
```
|
|
(UPPER("events"."period") + "events"."interval") > value
|
|
(UPPER("events"."period") + "events"."interval") > value
|
|
```
|
|
```
|
|
|
|
|
|
#### `:real_finishing_before` as `.period_real_finishing_before(value)`
|
|
#### `:real_finishing_before` as `.period_real_finishing_before(value)` **(ONLY WITH THRESHOLD)**
|
|
Filter records that the right value with the threshold is less than the one provided, which can be either an Arel attribute or a plain value.
|
|
Filter records that the right value with the threshold is less than the one provided, which can be either an Arel attribute or a plain value.
|
|
```
|
|
```
|
|
(UPPER("events"."period") + "events"."interval") < value
|
|
(UPPER("events"."period") + "events"."interval") < value
|
|
```
|
|
```
|
|
|
|
|
|
|
|
#### `:containing_date` as `.period_containing_date(value)` **(NON DATERANGE ONLY)**
|
|
|
|
Checks if the value contains in the range as date. You can pass either an Arel attribute or a plain value.
|
|
|
|
```
|
|
|
|
daterange(LOWER("events"."period")::date),UPPER("events"."period")::date) @> value
|
|
|
|
- With threshold -
|
|
|
|
daterange((LOWER("events"."period") - "events"."interval")::date),(UPPER("events"."period") + "events"."interval")::date) @> value
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `:not_containing_date` as `.period_not_containing_date(value)` **(NON DATERANGE ONLY)**
|
|
|
|
The opposite version of the `:containing_date` scope.
|
|
|
|
```
|
|
|
|
NOT daterange(LOWER("events"."period")::date),UPPER("events"."period")::date) @> value
|
|
|
|
- With threshold -
|
|
|
|
NOT daterange((LOWER("events"."period") - "events"."interval")::date),(UPPER("events"."period") + "events"."interval")::date) @> value
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `:overlapping_date` as `.period_overlapping_date(left, right = nil)` **(NON DATERANGE ONLY)**
|
|
|
|
Checks if two ranges overlap but comparing only dates. You can pass either another range column as an Arel attribute, a plain range on the left, or the 2 parts of a range.
|
|
|
|
```
|
|
|
|
daterange(LOWER("events"."period")::date),UPPER("events"."period")::date) && value
|
|
|
|
- OR -
|
|
|
|
daterange(LOWER("events"."period")::date),UPPER("events"."period")::date) && daterange(left, right)
|
|
|
|
- With threshold -
|
|
|
|
daterange((LOWER("events"."period") - "events"."interval")::date),(UPPER("events"."period") + "events"."interval")::date) && value
|
|
|
|
- OR -
|
|
|
|
daterange((LOWER("events"."period") - "events"."interval")::date),(UPPER("events"."period") + "events"."interval")::date) && daterange(left, right)
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `:not_overlapping_date` as `.period_not_overlapping_date(left, right = nil)` **(NON DATERANGE ONLY)**
|
|
|
|
The opposite version of the `:overlapping_date` scope.
|
|
|
|
```
|
|
|
|
NOT daterange(LOWER("events"."period")::date),UPPER("events"."period")::date) && value
|
|
|
|
- OR -
|
|
|
|
NOT daterange(LOWER("events"."period")::date),UPPER("events"."period")::date) && daterange(left, right)
|
|
|
|
- With threshold -
|
|
|
|
NOT daterange((LOWER("events"."period") - "events"."interval")::date),(UPPER("events"."period") + "events"."interval")::date) && value
|
|
|
|
- OR -
|
|
|
|
NOT daterange((LOWER("events"."period") - "events"."interval")::date),(UPPER("events"."period") + "events"."interval")::date) && daterange(left, right)
|
|
|
|
``` |
|
|
|
\ No newline at end of file |