Sha256: 8d07b776a749d4f67b76167fcd0aa457ac9a3847637af0a620af4a3305bd21aa

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

module AgnosticBackend
  module Queryable
    class Executor

      attr_reader :query
      attr_reader :visitor
      attr_reader :options

      def initialize(query, visitor, **options)
        @query = query
        @visitor = visitor
        @options = options
      end

      def execute
        raise NotImplementedError, 'Abstract method'
      end

      private

      def order_expression
        query.children.find { |e| e.is_a? Expressions::Order }
      end

      def where_expression
        query.children.find { |e| e.is_a? Expressions::Where }
      end

      def select_expression
        query.children.find { |e| e.is_a? Expressions::Select }
      end

      def limit_expression
        query.children.find { |e| e.is_a? Expressions::Limit }
      end

      def offset_expression
        query.children.find { |e| e.is_a? Expressions::Offset }
      end

      def scroll_cursor_expression
        query.children.find { |e| e.is_a? Expressions::ScrollCursor }
      end

      def filter_expression
        query.children.find { |e| e.is_a? Expressions::Filter }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
agnostic_backend-1.0.4 lib/agnostic_backend/queryable/executor.rb
agnostic_backend-1.0.3 lib/agnostic_backend/queryable/executor.rb
agnostic_backend-1.0.2 lib/agnostic_backend/queryable/executor.rb
agnostic_backend-1.0.1 lib/agnostic_backend/queryable/executor.rb
agnostic_backend-1.0.0 lib/agnostic_backend/queryable/executor.rb