@@ -27,7 +27,8 @@ use graph::{
2727use crate :: execution:: { ast as a, ExecutionContext , Resolver } ;
2828use crate :: runner:: ResultSizeMetrics ;
2929use crate :: schema:: ast as sast;
30- use crate :: store:: { build_query, StoreResolver } ;
30+ use crate :: store:: query:: build_query;
31+ use crate :: store:: StoreResolver ;
3132
3233lazy_static ! {
3334 static ref ARG_FIRST : String = String :: from( "first" ) ;
@@ -54,42 +55,6 @@ type GroupedFieldSet<'a> = IndexMap<&'a str, CollectedResponseKey<'a>>;
5455/// attributes.
5556type ComplementaryFields < ' a > = BTreeMap < ObjectOrInterface < ' a > , String > ;
5657
57- /// An `ObjectType` with `Hash` and `Eq` derived from the name.
58- #[ derive( Clone , Debug ) ]
59- pub struct ObjectCondition < ' a > ( & ' a s:: ObjectType ) ;
60-
61- impl < ' a > Ord for ObjectCondition < ' a > {
62- fn cmp ( & self , other : & Self ) -> std:: cmp:: Ordering {
63- self . 0 . name . cmp ( & other. 0 . name )
64- }
65- }
66-
67- impl < ' a > PartialOrd for ObjectCondition < ' a > {
68- fn partial_cmp ( & self , other : & Self ) -> Option < std:: cmp:: Ordering > {
69- Some ( self . 0 . name . cmp ( & other. 0 . name ) )
70- }
71- }
72-
73- impl std:: hash:: Hash for ObjectCondition < ' _ > {
74- fn hash < H : std:: hash:: Hasher > ( & self , state : & mut H ) {
75- self . 0 . name . hash ( state)
76- }
77- }
78-
79- impl PartialEq for ObjectCondition < ' _ > {
80- fn eq ( & self , other : & Self ) -> bool {
81- self . 0 . name . eq ( & other. 0 . name )
82- }
83- }
84-
85- impl Eq for ObjectCondition < ' _ > { }
86-
87- impl < ' a > From < & ' a s:: ObjectType > for ObjectCondition < ' a > {
88- fn from ( object : & ' a s:: ObjectType ) -> Self {
89- ObjectCondition ( object)
90- }
91- }
92-
9358/// Intermediate data structure to hold the results of prefetching entities
9459/// and their nested associations. For each association of `entity`, `children`
9560/// has an entry mapping the response key to the list of nodes.
@@ -717,7 +682,7 @@ fn execute_selection_set<'a>(
717682struct CollectedResponseKey < ' a > {
718683 iface_cond : Option < & ' a s:: InterfaceType > ,
719684 iface_fields : Vec < & ' a a:: Field > ,
720- obj_types : IndexMap < ObjectCondition < ' a > , Vec < & ' a a:: Field > > ,
685+ obj_types : IndexMap < sast :: ObjectCondition < ' a > , Vec < & ' a a:: Field > > ,
721686 collected_column_names : CollectedAttributeNames < ' a > ,
722687}
723688
@@ -745,10 +710,7 @@ impl<'a> CollectedResponseKey<'a> {
745710 self . iface_fields . push ( field) ;
746711 }
747712 ObjectOrInterface :: Object ( o) => {
748- self . obj_types
749- . entry ( ObjectCondition ( o) )
750- . or_default ( )
751- . push ( field) ;
713+ self . obj_types . entry ( o. into ( ) ) . or_default ( ) . push ( field) ;
752714 }
753715 }
754716 }
@@ -776,11 +738,7 @@ impl<'a> IntoIterator for CollectedResponseKey<'a> {
776738 self . iface_cond
777739 . map ( |cond| ( ObjectOrInterface :: Interface ( cond) , iface_fields) )
778740 . into_iter ( )
779- . chain (
780- self . obj_types
781- . into_iter ( )
782- . map ( |( c, f) | ( ObjectOrInterface :: Object ( c. 0 ) , f) ) ,
783- ) ,
741+ . chain ( self . obj_types . into_iter ( ) . map ( |( c, f) | ( c. into ( ) , f) ) ) ,
784742 )
785743 }
786744}
@@ -1057,7 +1015,7 @@ fn fetch(
10571015
10581016/// Represents a finished column collection operation, mapping each object type to the final set of
10591017/// selected SQL columns.
1060- type AttributeNamesByObjectType < ' a > = BTreeMap < ObjectCondition < ' a > , AttributeNames > ;
1018+ type AttributeNamesByObjectType < ' a > = BTreeMap < sast :: ObjectCondition < ' a > , AttributeNames > ;
10611019
10621020#[ derive( Debug , Default , Clone ) ]
10631021struct CollectedAttributeNames < ' a > ( HashMap < ObjectOrInterface < ' a > , AttributeNames > ) ;
@@ -1110,12 +1068,12 @@ impl<'a> CollectedAttributeNames<'a> {
11101068
11111069 /// Helper function for handling insertion on the `AttributeNamesByObjectType` struct.
11121070 fn upsert (
1113- map : & mut BTreeMap < ObjectCondition < ' a > , AttributeNames > ,
1071+ map : & mut BTreeMap < sast :: ObjectCondition < ' a > , AttributeNames > ,
11141072 object : & ' a s:: ObjectType ,
11151073 column_names : AttributeNames ,
11161074 ) {
11171075 use std:: collections:: btree_map:: Entry ;
1118- let key = ObjectCondition ( object) ;
1076+ let key = object. into ( ) ;
11191077 let column_names = filter_derived_fields ( column_names, object) ;
11201078 match map. entry ( key) {
11211079 Entry :: Occupied ( mut entry) => {
0 commit comments