@@ -16,8 +16,8 @@ use graph::components::store::EntityKey;
16
16
use graph:: data:: value:: Word ;
17
17
use graph:: prelude:: {
18
18
anyhow, r, serde_json, Attribute , BlockNumber , ChildMultiplicity , Entity , EntityCollection ,
19
- EntityFilter , EntityLink , EntityOrder , EntityOrderByChildInterface , EntityOrderChild ,
20
- EntityRange , EntityWindow , ParentLink , QueryExecutionError , StoreError , Value , ENV_VARS ,
19
+ EntityFilter , EntityLink , EntityOrder , EntityOrderByChild , EntityOrderByChildInfo , EntityRange ,
20
+ EntityWindow , ParentLink , QueryExecutionError , StoreError , Value , ENV_VARS ,
21
21
} ;
22
22
use graph:: {
23
23
components:: store:: { AttributeNames , EntityType } ,
@@ -2784,20 +2784,20 @@ impl<'a> SortKey<'a> {
2784
2784
}
2785
2785
2786
2786
fn with_child_interface_key < ' a > (
2787
- children : EntityOrderByChildInterface ,
2787
+ child : EntityOrderByChildInfo ,
2788
+ entity_types : Vec < EntityType > ,
2788
2789
direction : & ' static str ,
2789
2790
parent_table : & ' a Table ,
2790
2791
layout : & ' a Layout ,
2791
2792
) -> Result < SortKey < ' a > , QueryExecutionError > {
2792
2793
let mut i = 0 ;
2793
2794
2794
2795
Ok ( SortKey :: ChildKey ( ChildKey :: Many (
2795
- children
2796
- . entity_types
2796
+ entity_types
2797
2797
. iter ( )
2798
2798
. map ( |entity_type| {
2799
2799
let child_table = layout. table_for_entity ( entity_type) ?;
2800
- let sort_by_column = child_table. column_for_field ( & children . attribute ) ?;
2800
+ let sort_by_column = child_table. column_for_field ( & child . sort_by_attribute ) ?;
2801
2801
if sort_by_column. is_fulltext ( ) {
2802
2802
Err ( QueryExecutionError :: NotSupported (
2803
2803
"Sorting by fulltext fields" . to_string ( ) ,
@@ -2807,26 +2807,26 @@ impl<'a> SortKey<'a> {
2807
2807
"Sorting by id" . to_string ( ) ,
2808
2808
) )
2809
2809
} else {
2810
- let ( parent_column, child_column) = match children . derived {
2810
+ let ( parent_column, child_column) = match child . derived {
2811
2811
true => (
2812
2812
parent_table. primary_key ( ) ,
2813
2813
child_table
2814
- . column_for_field ( & children . join_attribute )
2814
+ . column_for_field ( & child . join_attribute )
2815
2815
. map_err ( |_| {
2816
2816
graph:: constraint_violation!(
2817
2817
"Column for a join attribute `{}` of `{}` table not found" ,
2818
- children . join_attribute,
2818
+ child . join_attribute,
2819
2819
child_table. name. as_str( )
2820
2820
)
2821
2821
} ) ?,
2822
2822
) ,
2823
2823
false => (
2824
2824
parent_table
2825
- . column_for_field ( & children . join_attribute )
2825
+ . column_for_field ( & child . join_attribute )
2826
2826
. map_err ( |_| {
2827
2827
graph:: constraint_violation!(
2828
2828
"Column for a join attribute `{}` of `{}` table not found" ,
2829
- children . join_attribute,
2829
+ child . join_attribute,
2830
2830
parent_table. name. as_str( )
2831
2831
)
2832
2832
} ) ?,
@@ -2871,31 +2871,31 @@ impl<'a> SortKey<'a> {
2871
2871
EntityOrder :: Default => Ok ( SortKey :: IdAsc ( br_column) ) ,
2872
2872
EntityOrder :: Unordered => Ok ( SortKey :: None ) ,
2873
2873
EntityOrder :: ChildAscending ( kind) => match kind {
2874
- EntityOrderChild :: Object ( child) => with_child_object_key (
2874
+ EntityOrderByChild :: Object ( child, entity_type ) => with_child_object_key (
2875
2875
table,
2876
- layout. table_for_entity ( & child . entity_type ) ?,
2876
+ layout. table_for_entity ( & entity_type) ?,
2877
2877
child. join_attribute ,
2878
2878
child. derived ,
2879
- child. attribute ,
2879
+ child. sort_by_attribute ,
2880
2880
br_column,
2881
2881
ASC ,
2882
2882
) ,
2883
- EntityOrderChild :: Interface ( children ) => {
2884
- with_child_interface_key ( children , ASC , table, layout)
2883
+ EntityOrderByChild :: Interface ( child , entity_types ) => {
2884
+ with_child_interface_key ( child , entity_types , ASC , table, layout)
2885
2885
}
2886
2886
} ,
2887
2887
EntityOrder :: ChildDescending ( kind) => match kind {
2888
- EntityOrderChild :: Object ( child) => with_child_object_key (
2888
+ EntityOrderByChild :: Object ( child, entity_type ) => with_child_object_key (
2889
2889
table,
2890
- layout. table_for_entity ( & child . entity_type ) ?,
2890
+ layout. table_for_entity ( & entity_type) ?,
2891
2891
child. join_attribute ,
2892
2892
child. derived ,
2893
- child. attribute ,
2893
+ child. sort_by_attribute ,
2894
2894
br_column,
2895
2895
DESC ,
2896
2896
) ,
2897
- EntityOrderChild :: Interface ( children ) => {
2898
- with_child_interface_key ( children , DESC , table, layout)
2897
+ EntityOrderByChild :: Interface ( child , entity_types ) => {
2898
+ with_child_interface_key ( child , entity_types , DESC , table, layout)
2899
2899
}
2900
2900
} ,
2901
2901
}
0 commit comments