Sha256: 80c43cb1dd404e4d4720cf96ab8c570fa7c6cb5c7970f193924b57a590e28b35

Contents?: true

Size: 1.42 KB

Versions: 7

Compression:

Stored size: 1.42 KB

Contents

module AgnosticBackend
  module Queryable
    module Expressions
      class Expression < TreeNode
      end

      class Where < Expression
        def initialize(criterion:, context:)
          super([criterion], context)
        end

        def criterion
          children.first
        end
      end

      class Select < Expression
        def initialize(attributes:, context:)
          super(attributes.map { |a| Attribute.new(a, parent: self, context: context) }, context)
        end

        alias_method :projections, :children
      end

      class Order < Expression
        def initialize(attributes:, context:)
          super(attributes, context)
        end

        alias_method :qualifiers, :children
      end

      class Limit < Expression
        def initialize(value:, context:)
          super([Value.new(value, parent: self, context: context)], context)
        end

        def limit
          children.first
        end
      end

      class Offset < Expression
        def initialize(value:, context:)
          super([Value.new(value, parent: self, context: context)], context)
        end

        def offset
          children.first
        end
      end

      class ScrollCursor < Expression
        def initialize(value:, context:)
          super([Value.new(value, parent: self, context: context)], context)
        end

        def scroll_cursor
          children.first
        end
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
agnostic_backend-0.9.9 lib/agnostic_backend/queryable/expressions/expression.rb
agnostic_backend-0.9.8 lib/agnostic_backend/queryable/expressions/expression.rb
agnostic_backend-0.9.4 lib/agnostic_backend/queryable/expressions/expression.rb
agnostic_backend-0.9.3 lib/agnostic_backend/queryable/expressions/expression.rb
agnostic_backend-0.9.2 lib/agnostic_backend/queryable/expressions/expression.rb
agnostic_backend-0.9.1 lib/agnostic_backend/queryable/expressions/expression.rb
agnostic_backend-0.9.0 lib/agnostic_backend/queryable/expressions/expression.rb