Module: Sequel

Defined in:
lib/sequel/plugins/tstzrange_fields.rb,
lib/sequel/plugins/tstzmultirange_fields.rb

Overview

Plugin for adding methods for working with time ranges.

Example

Defining a model class with a timestamptz multirange:

class Reminder < Sequel::Model(:reminders)
  plugin :tstzmultirange_fields, :active_during

And in the schema:

create_table(:reminders) do
  primary_key :id
  tstzmultirange :active_during
end

You can use it as follows:

r = Reminder.new
reminder.active_during = [{begin: Time.now, end: 1.year.from_now}]
reminder.active_during = [1.year.ago..1.year.from_now]
reminder.active_during = [Time.now..]
reminder.active_during = []

Defined Under Namespace

Modules: Plugins