Module: Sequel::Plugins::TstzrangeFields::DatasetMethods
- Defined in:
- lib/sequel/plugins/tstzrange_fields.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.
133 134 135 136 |
# File 'lib/sequel/plugins/tstzrange_fields.rb', line 133 def tstzrange_contains(val, column: nil) column ||= self.model.tstzrange_columns.first self.where(Sequel.pg_range(column).contains(Sequel.cast(val, :timestamptz))) end |