@@ -26,8 +26,6 @@ lazy_static! {
26
26
static ref ARG_ID : String = String :: from( "id" ) ;
27
27
}
28
28
29
- pub const PREFETCH_KEY : & str = ":prefetch" ;
30
-
31
29
/// Similar to the TypeCondition from graphql_parser, but with
32
30
/// derives that make it possible to use it as the key in a HashMap
33
31
#[ derive( Clone , Debug , PartialEq , Eq , Hash ) ]
@@ -146,13 +144,10 @@ fn make_root_node() -> Vec<Node> {
146
144
/// Recursively convert a `Node` into the corresponding `q::Value`, which is
147
145
/// always a `q::Value::Object`. The entity's associations are mapped to
148
146
/// entries `r:{response_key}` as that name is guaranteed to not conflict
149
- /// with any field of the entity. Also add an entry `:prefetch` so that
150
- /// the resolver can later tell whether the `q::Value` was produced by prefetch
151
- /// and should therefore have `r:{response_key}` entries.
147
+ /// with any field of the entity.
152
148
impl From < Node > for q:: Value {
153
149
fn from ( node : Node ) -> Self {
154
150
let mut map: BTreeMap < _ , _ > = node. entity . into ( ) ;
155
- map. insert ( PREFETCH_KEY . to_owned ( ) , q:: Value :: Boolean ( true ) ) ;
156
151
for ( key, nodes) in node. children . into_iter ( ) {
157
152
map. insert ( format ! ( "prefetch:{}" , key) , node_list_as_value ( nodes) ) ;
158
153
}
@@ -445,9 +440,7 @@ impl<'a> Join<'a> {
445
440
/// The returned value contains a `q::Value::Object` that contains a tree of
446
441
/// all the entities (converted into objects) in the form in which they need
447
442
/// to be returned. Nested object fields appear under the key `r:response_key`
448
- /// in these objects, and are always `q::Value::List` of objects. In addition,
449
- /// each entity has a property `:prefetch` set so that the resolver can
450
- /// tell whether the `r:response_key` associations should be there.
443
+ /// in these objects, and are always `q::Value::List` of objects.
451
444
///
452
445
/// For the above example, the returned object would have one entry under
453
446
/// `r:musicians`, which is a list of all the musicians; each musician has an
@@ -462,8 +455,7 @@ pub fn run(
462
455
selection_set : & q:: SelectionSet ,
463
456
) -> Result < q:: Value , Vec < QueryExecutionError > > {
464
457
execute_root_selection_set ( resolver, ctx, selection_set) . map ( |nodes| {
465
- let mut map = BTreeMap :: default ( ) ;
466
- map. insert ( PREFETCH_KEY . to_owned ( ) , q:: Value :: Boolean ( true ) ) ;
458
+ let map = BTreeMap :: default ( ) ;
467
459
q:: Value :: Object ( nodes. into_iter ( ) . fold ( map, |mut map, node| {
468
460
// For root nodes, we only care about the children
469
461
for ( key, nodes) in node. children . into_iter ( ) {
0 commit comments