Module: RDBr::Query::TypeSupport
- Included in:
- Relational
- Defined in:
- lib/rdbr/query/type_support.rb
Constant Summary collapse
- FILTER_OPERATORS =
{ text: [ :eq, :contains, :starts_with, :is_null ], numeric: [ :eq, :gt, :gte, :lt, :lte, :is_null ], temporal: [ :eq, :gt, :gte, :lt, :lte, :from, :to, :is_null ], identifier: [ :eq, :is_null ], boolean: [ :eq, :is_null ], other: [ :eq, :is_null ] }.freeze
- TYPE_GROUPS =
{ text: %i[bpchar char citext name text varchar], numeric: %i[decimal float4 float8 int2 int4 int8 money numeric oid], temporal: %i[date interval time timestamp timestamptz timetz], identifier: %i[uuid], boolean: %i[bool boolean] }.freeze
- INTEGER_TYPES =
%i[int2 int4 int8 oid].freeze
Instance Method Summary collapse
- #filter_operators(column) ⇒ Object
- #groupable_column?(column) ⇒ Boolean
- #sortable_column?(column) ⇒ Boolean
Instance Method Details
#filter_operators(column) ⇒ Object
21 22 23 |
# File 'lib/rdbr/query/type_support.rb', line 21 def filter_operators(column) FILTER_OPERATORS.fetch(type_group(column)) end |
#groupable_column?(column) ⇒ Boolean
29 30 31 |
# File 'lib/rdbr/query/type_support.rb', line 29 def groupable_column?(column) !%i[json xml].include?(column.logical_type.to_s.to_sym) end |
#sortable_column?(column) ⇒ Boolean
25 26 27 |
# File 'lib/rdbr/query/type_support.rb', line 25 def sortable_column?(column) type_group(column) != :other end |