Class: Gitlab::Database::QueryAnalyzers::PreventSetOperatorMismatch::References

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/database/query_analyzers/prevent_set_operator_mismatch/references.rb

Class Method Summary collapse

Class Method Details

.errors?(refs) ⇒ Boolean

Whether any currently resolved references have resulted in an error state.

Parameters:

  • refs (Hash)

    A Hash of reference names mapped to the parse tree node or resolved Set of Types.

Returns:

  • (Boolean)


42
43
44
# File 'lib/gitlab/database/query_analyzers/prevent_set_operator_mismatch/references.rb', line 42

def errors?(refs)
  resolved(refs).any? { |_, values| values.include?(Type::INVALID) }
end

.resolved(refs) ⇒ Object

All references that have already been parsed to determine static/dynamic/error state.

Parameters:

  • refs (Hash)

    A Hash of reference names mapped to the parse tree node or resolved Set of Types.



30
31
32
# File 'lib/gitlab/database/query_analyzers/prevent_set_operator_mismatch/references.rb', line 30

def resolved(refs)
  refs.select { |_name, ref| ref.is_a?(Set) }
end

.unresolved(refs) ⇒ Object

All references that have not been parsed to determine static/dynamic/error state.

Parameters:

  • refs (Hash)

    A Hash of reference names mapped to the parse tree node or resolved Set of Types.



36
37
38
# File 'lib/gitlab/database/query_analyzers/prevent_set_operator_mismatch/references.rb', line 36

def unresolved(refs)
  refs.select { |_name, ref| unresolved?(ref) }
end