class ActiveGraph::Shared::RelQueryFactory

Protected Instance Methods

create_query() click to toggle source
   # File lib/active_graph/shared/query_factory.rb
84 def create_query
85   return match_query if graph_object.persisted?
86   create_props, set_props = filtered_props
87   base_query.send(graph_object.create_method, query_string(create_props)).break
88     .set(identifier => set_props)
89     .params(params(create_props))
90 end
match_string() click to toggle source
   # File lib/active_graph/shared/query_factory.rb
80 def match_string
81   "(#{graph_object.from_node_identifier})-[#{identifier}]->()"
82 end

Private Instance Methods

filtered_props() click to toggle source
   # File lib/active_graph/shared/query_factory.rb
94 def filtered_props
95   ActiveGraph::Shared::FilteredHash.new(graph_object.props_for_create, graph_object.creates_unique_option).filtered_base
96 end
namespace() click to toggle source
    # File lib/active_graph/shared/query_factory.rb
118 def namespace
119   "#{identifier}_create_props"
120 end
params(create_props) click to toggle source
    # File lib/active_graph/shared/query_factory.rb
102 def params(create_props)
103   unique? ? create_props.transform_keys { |key| scoped(key).to_sym } : { namespace.to_sym => create_props }
104 end
pattern(create_props) click to toggle source
    # File lib/active_graph/shared/query_factory.rb
110 def pattern(create_props)
111   unique? ? "{#{create_props.keys.map { |key| "#{key}: $#{scoped(key)}" }.join(', ')}}" : "$#{namespace}"
112 end
query_string(create_props) click to toggle source
    # File lib/active_graph/shared/query_factory.rb
 98 def query_string(create_props)
 99   "(#{graph_object.from_node_identifier})-[#{identifier}:`#{graph_object.type}` #{pattern(create_props)}]->(#{graph_object.to_node_identifier})"
100 end
scoped(key) click to toggle source
    # File lib/active_graph/shared/query_factory.rb
114 def scoped(key)
115   "#{namespace}_#{key}"
116 end
unique?() click to toggle source
    # File lib/active_graph/shared/query_factory.rb
106 def unique?
107   graph_object.create_method == :create_unique
108 end