Module: SequelTstzrangeFields::Helpers::DatasetMethods
- Included in:
- Sequel::Plugins::TstzrangeFields::DatasetMethods
- Defined in:
- lib/sequel_tstzrange_fields/helpers.rb
Instance Method Summary collapse
-
#tstzrange_contains(val, column: nil) ⇒ Object
Limit the dataset to the rows where the tstzrange column contains the given value.
Instance Method Details
#tstzrange_contains(val, column: nil) ⇒ Object
Limit the dataset to the rows where the tstzrange column contains the given value. val is cast into a timestamptz. column is the default/first tstzrange column if not given.
49 50 51 52 |
# File 'lib/sequel_tstzrange_fields/helpers.rb', line 49 def tstzrange_contains(val, column: nil) column ||= self.model.tstzrange_columns.first self.where(Sequel.pg_range(column).contains(Sequel.cast(val, :timestamptz))) end |