Module: Timescaledb::Database::Types

Included in:
Timescaledb::Database
Defined in:
lib/timescaledb/database/types.rb

Instance Method Summary collapse

Instance Method Details

#boolean_to_sql(boolean) ⇒ String

Parameters:

  • boolean (String)

    The boolean value

Returns:

  • (String)


15
16
17
# File 'lib/timescaledb/database/types.rb', line 15

def boolean_to_sql(boolean)
  quote(boolean ? 'TRUE' : 'FALSE')
end

#interval_to_sql(interval) ⇒ String

Parameters:

  • interval (String, Integer)

    The interval value

Returns:

  • (String)


6
7
8
9
10
11
# File 'lib/timescaledb/database/types.rb', line 6

def interval_to_sql(interval)
  return 'NULL' if interval.nil?
  return interval if interval.kind_of?(Integer)

  "INTERVAL #{quote(interval)}"
end