@@ -447,13 +447,13 @@ pub struct ScanByTimeAndId<Selector = ()> {
447
447
#[ serde( rename_all = "snake_case" ) ]
448
448
pub enum TimeAndIdSortMode {
449
449
/// sort in increasing order of timestamp and ID, i.e., earliest first
450
- Ascending ,
450
+ TimeAndIdAscending ,
451
451
/// sort in increasing order of timestamp and ID, i.e., most recent first
452
- Descending ,
452
+ TimeAndIdDescending ,
453
453
}
454
454
455
455
fn default_ts_id_sort_mode ( ) -> TimeAndIdSortMode {
456
- TimeAndIdSortMode :: Ascending
456
+ TimeAndIdSortMode :: TimeAndIdAscending
457
457
}
458
458
459
459
impl < T : Clone + Debug + DeserializeOwned + JsonSchema + PartialEq + Serialize >
@@ -462,8 +462,10 @@ impl<T: Clone + Debug + DeserializeOwned + JsonSchema + PartialEq + Serialize>
462
462
type MarkerValue = ( DateTime < Utc > , Uuid ) ;
463
463
fn direction ( & self ) -> PaginationOrder {
464
464
match self . sort_by {
465
- TimeAndIdSortMode :: Ascending => PaginationOrder :: Ascending ,
466
- TimeAndIdSortMode :: Descending => PaginationOrder :: Descending ,
465
+ TimeAndIdSortMode :: TimeAndIdAscending => PaginationOrder :: Ascending ,
466
+ TimeAndIdSortMode :: TimeAndIdDescending => {
467
+ PaginationOrder :: Descending
468
+ }
467
469
}
468
470
}
469
471
fn from_query ( p : & PaginatedByTimeAndId < T > ) -> Result < & Self , HttpError > {
@@ -579,7 +581,7 @@ mod test {
579
581
selector : ( ) ,
580
582
} ;
581
583
let scan_by_time_and_id = ScanByTimeAndId :: < ( ) > {
582
- sort_by : TimeAndIdSortMode :: Ascending ,
584
+ sort_by : TimeAndIdSortMode :: TimeAndIdAscending ,
583
585
selector : ( ) ,
584
586
} ;
585
587
let id: Uuid = "61a78113-d3c6-4b35-a410-23e9eae64328" . parse ( ) . unwrap ( ) ;
@@ -961,7 +963,7 @@ mod test {
961
963
#[ test]
962
964
fn test_scan_by_time_and_id ( ) {
963
965
let scan = ScanByTimeAndId {
964
- sort_by : TimeAndIdSortMode :: Ascending ,
966
+ sort_by : TimeAndIdSortMode :: TimeAndIdAscending ,
965
967
selector : ( ) ,
966
968
} ;
967
969
@@ -982,7 +984,7 @@ mod test {
982
984
let ( p0, p1) = test_scan_param_common (
983
985
& list,
984
986
& scan,
985
- "sort_by=ascending " ,
987
+ "sort_by=time_and_id_ascending " ,
986
988
& item0_marker,
987
989
& item_last_marker,
988
990
& scan,
@@ -1005,13 +1007,13 @@ mod test {
1005
1007
1006
1008
// test descending too, why not (it caught a mistake!)
1007
1009
let scan_desc = ScanByTimeAndId {
1008
- sort_by : TimeAndIdSortMode :: Descending ,
1010
+ sort_by : TimeAndIdSortMode :: TimeAndIdDescending ,
1009
1011
selector : ( ) ,
1010
1012
} ;
1011
1013
let ( p0, p1) = test_scan_param_common (
1012
1014
& list,
1013
1015
& scan_desc,
1014
- "sort_by=descending " ,
1016
+ "sort_by=time_and_id_descending " ,
1015
1017
& item0_marker,
1016
1018
& item_last_marker,
1017
1019
& scan,
@@ -1039,7 +1041,7 @@ mod test {
1039
1041
1040
1042
assert_eq ! (
1041
1043
error. to_string( ) ,
1042
- "unknown variant `nothing`, expected `ascending ` or `descending `"
1044
+ "unknown variant `nothing`, expected `time_and_id_ascending ` or `time_and_id_descending `"
1043
1045
) ;
1044
1046
}
1045
1047
}
0 commit comments