Class: Sequel::Platform::Postgres

Inherits:
Base
  • Object
show all
Defined in:
lib/sequel/extensions/platform.rb

Overview

PostgreSQL platform with Postgres-specific function translations.

Instance Attribute Summary

Attributes inherited from Base

#config, #db

Instance Method Summary collapse

Methods inherited from Base

#[], #cast_date, #fetch, #initialize, #prefers?, #str_to_date, #supports?

Constructor Details

This class inherits a constructor from Sequel::Platform::Base

Instance Method Details

#date_diff(from, to) ⇒ Object



131
132
133
134
# File 'lib/sequel/extensions/platform.rb', line 131

def date_diff(from, to)
  # Postgres uses date subtraction
  Sequel.lit('(? - ?)', to, from)
end

#days_between(from, to) ⇒ Object



136
137
138
139
# File 'lib/sequel/extensions/platform.rb', line 136

def days_between(from, to)
  # Postgres date subtraction returns integer days
  Sequel.lit('(? - ?)', to, from)
end