File tree Expand file tree Collapse file tree 3 files changed +69
-0
lines changed
lib/graphiti/active_graph Expand file tree Collapse file tree 3 files changed +69
-0
lines changed Original file line number Diff line number Diff line change 1+ module Graphiti ::ActiveGraph ::Extensions ::QueryDsl
2+ module Performer
3+ attr_accessor :with_vars , :skip_arrow_cypher_rels
4+
5+ def apply_query_dsl
6+ query_param = resource . context &.params &.[]( :query )
7+ query_param . present? ? apply_query_param ( query_param ) : scope
8+ end
9+
10+ def apply_query_param ( query_param )
11+ @scope = query_generator . new ( query_param , **query_generator_config ) . tap do |qg |
12+ qg . generate_functions_optional_match
13+ qg . generate_with_clause_partition_query
14+ qg . generate_match_query
15+ qg . generate_with_clause_query
16+ end . query
17+ end
18+
19+ private
20+
21+ def query_generator
22+ Graphiti ::ActiveGraph ::Extensions ::QueryDsl ::QueryGenerator
23+ end
24+
25+ def query_generator_config
26+ require 'pry'
27+ binding . pry
28+ {
29+ query : scope ,
30+ with_vars_to_carry :,
31+ skip_arrow_cypher_rels : skip_arrow_cypher_rels || [ ] ,
32+ resource : resource . class
33+ }
34+ end
35+
36+ def with_vars_to_carry
37+ ( query ? with_vars_for_sort : [ ] ) . push ( *with_vars ) . push ( *Graphiti . context [ :with_vars ] ) . compact
38+ end
39+ end
40+ end
Original file line number Diff line number Diff line change 1+ module Graphiti ::ActiveGraph ::Extensions ::QueryDsl
2+ class QueryGenerator
3+ def initialize ( query_param , query :, **config )
4+ @query_param = query_param
5+ @query = query
6+ end
7+
8+ def generate_functions_optional_match
9+ end
10+
11+ def generate_with_clause_partition_query
12+ end
13+
14+ def generate_match_query
15+ end
16+
17+ def generate_with_clause_query
18+ end
19+ end
20+ end
Original file line number Diff line number Diff line change @@ -2,6 +2,15 @@ module Graphiti::ActiveGraph
22 module Scoping
33 module Filter
44 include Filterable
5+ include Internal ::SortingAliases
6+ include Extensions ::QueryDsl ::Performer
7+
8+ attr_reader :scope
9+
10+ def apply
11+ super
12+ apply_query_dsl
13+ end
514
615 def each_filter
716 filter_param . each_pair do |param_name , param_value |
You can’t perform that action at this time.
0 commit comments