Module: SearchCop::Visitors::Mysql

Defined in:
lib/search_cop/visitors/mysql.rb

Defined Under Namespace

Classes: FulltextQuery

Instance Method Summary collapse

Instance Method Details

#visit_SearchCopGrammar_Attributes_Collection(node) ⇒ Object



38
39
40
# File 'lib/search_cop/visitors/mysql.rb', line 38

def visit_SearchCopGrammar_Attributes_Collection(node)
  node.attributes.collect { |attribute| visit attribute }.join(", ")
end

#visit_SearchCopGrammar_Attributes_Json(attribute) ⇒ Object

rubocop:disable Naming/MethodName



6
7
8
# File 'lib/search_cop/visitors/mysql.rb', line 6

def visit_SearchCopGrammar_Attributes_Json(attribute)
  "#{quote_table_name attribute.table_alias}.#{quote_column_name attribute.column_name}->#{quote "$.#{attribute.field_names.join(".")}"}"
end

#visit_SearchCopGrammar_Nodes_FulltextExpression(node) ⇒ Object



42
43
44
# File 'lib/search_cop/visitors/mysql.rb', line 42

def visit_SearchCopGrammar_Nodes_FulltextExpression(node)
  "MATCH(#{visit node.collection}) AGAINST(#{visit FulltextQuery.new(connection).visit(node.node)} IN BOOLEAN MODE)"
end