Class: ElasticGraph::QueryInterceptor::DatastoreQueryAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic_graph/query_interceptor/datastore_query_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(interceptors) ⇒ DatastoreQueryAdapter

Returns a new instance of DatastoreQueryAdapter.



15
16
17
# File 'lib/elastic_graph/query_interceptor/datastore_query_adapter.rb', line 15

def initialize(interceptors)
  @interceptors = interceptors
end

Instance Attribute Details

#interceptorsObject (readonly)

Returns the value of attribute interceptors.



13
14
15
# File 'lib/elastic_graph/query_interceptor/datastore_query_adapter.rb', line 13

def interceptors
  @interceptors
end

Instance Method Details

#call(query:, args:, lookahead:, field:, context:) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/elastic_graph/query_interceptor/datastore_query_adapter.rb', line 19

def call(query:, args:, lookahead:, field:, context:)
  http_request = context[:http_request]

  interceptors.reduce(query) do |accum, interceptor|
    interceptor.intercept(accum, field: field, args: args, http_request: http_request, context: context)
  end
end