tsMRevRange2 method

  1. @Deprecated('DO NOT USE. Will be removed in the future.')
Future tsMRevRange2({
  1. Object? fromTimestamp,
  2. Object? toTimestamp,
  3. List<String> filters = const [],
  4. bool latest = false,
  5. List<int>? filterByTs,
  6. num? filterByValueMin,
  7. num? filterByValueMax,
  8. bool withLabels = false,
  9. List<String>? selectedLabels,
  10. int? count,
  11. Object? align,
  12. String? aggregator,
  13. int? bucketDuration,
  14. List? bucketTimestamp,
  15. bool empty = false,
  16. String? groupByLabel,
  17. String? reduceReducer,
  18. bool forceRun = false,
})

TS.MREVRANGE fromTimestamp toTimestamp ...

Implementation

@Deprecated('DO NOT USE. Will be removed in the future.')

/// TS.MREVRANGE fromTimestamp toTimestamp ...
Future<dynamic> tsMRevRange2({
  Object? fromTimestamp,
  Object? toTimestamp,
  List<String> filters = const [],
  bool latest = false,
  List<int>? filterByTs,
  num? filterByValueMin,
  num? filterByValueMax,
  bool withLabels = false,
  List<String>? selectedLabels,
  int? count,
  Object? align,
  String? aggregator,
  int? bucketDuration,
  List<dynamic>? bucketTimestamp,
  bool empty = false,
  String? groupByLabel,
  String? reduceReducer,
  bool forceRun = false,
}) async {
  await checkValkeySupport('TS.MREVRANGE', forceRun: forceRun);

  final cmd = <dynamic>['TS.MREVRANGE', fromTimestamp, toTimestamp];

  if (latest) cmd.add('LATEST');

  if (filterByTs != null && filterByTs.isNotEmpty) {
    cmd.addAll(['FILTER_BY_TS', ...filterByTs]);
  }

  if (filterByValueMin != null && filterByValueMax != null) {
    cmd.addAll(['FILTER_BY_VALUE', filterByValueMin, filterByValueMax]);
  }

  if (withLabels) {
    cmd.add('WITHLABELS');
  } else if (selectedLabels != null && selectedLabels.isNotEmpty) {
    cmd.addAll(['SELECTED_LABELS', ...selectedLabels]);
  }

  if (count != null) cmd.addAll(['COUNT', count]);

  if (align != null) cmd.addAll(['ALIGN', align]);

  if (aggregator != null && bucketDuration != null) {
    cmd.addAll(['AGGREGATION', aggregator, bucketDuration]);
  }

  if (bucketTimestamp != null && bucketTimestamp.isNotEmpty) {
    cmd.addAll(['BUCKETTIMESTAMP', ...bucketTimestamp]);
  }

  if (empty) cmd.add('EMPTY');

  if (groupByLabel != null && reduceReducer != null) {
    cmd.addAll(['GROUPBY', groupByLabel, 'REDUCE', reduceReducer]);
  }

  cmd.add('FILTER');
  cmd.addAll(filters);

  return execute(cmd);
}