Module: ROM::SQL::Postgres::Types::LTreeMethods

Defined in:
lib/rom/sql/extensions/postgres/types/ltree.rb

Constant Summary collapse

ASCENDANT =
['(', ' @> ', ')'].freeze
FIND_ASCENDANT =
['(', ' ?@> ', ')'].freeze
DESCENDANT =
['(', ' <@ ', ')'].freeze
FIND_DESCENDANT =
['(', ' ?<@ ', ')'].freeze
MATCH_ANY =
['(', ' ? ', ')'].freeze
MATCH_ANY_LQUERY =
['(', ' ?~ ', ')'].freeze
MATCH_LTEXTQUERY =
['(', ' @ ', ')'].freeze
MATCH_ANY_LTEXTQUERY =
['(', ' ?@ ', ')'].freeze

Instance Method Summary collapse

Instance Method Details

#match(_type, expr, query) ⇒ Object



236
237
238
# File 'lib/rom/sql/extensions/postgres/types/ltree.rb', line 236

def match(_type, expr, query)
  Attribute[SQL::Types::Bool].meta(sql_expr: Sequel::SQL::BooleanExpression.new(:'~', expr, query))
end

#match_any(_type, expr, query) ⇒ Object



240
241
242
243
# File 'lib/rom/sql/extensions/postgres/types/ltree.rb', line 240

def match_any(_type, expr, query)
  array = build_array_query(query)
  Attribute[SQL::Types::Bool].meta(sql_expr: custom_operator_expr(MATCH_ANY, expr, array))
end