Skip to content

Commit

Permalink
Update TabularDataByMQL to accept list of BSON docs instead of String…
Browse files Browse the repository at this point in the history
…. Resolves #RSDK-5873. (#154)
  • Loading branch information
ale7714 authored Nov 30, 2023
1 parent fbc03ba commit b52eaae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/src/app/data.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:io';
import 'dart:math';
import 'dart:typed_data';

import 'package:async/async.dart';
import 'package:collection/collection.dart';
Expand Down Expand Up @@ -124,10 +125,10 @@ class DataClient {
}

/// Obtain unified tabular data and metadata, queried with MQL.
Future<List<Map<String, dynamic>>> tabularDataByMql(String organizationId, String query) async {
Future<List<Map<String, dynamic>>> tabularDataByMql(String organizationId, List<Uint8List> query) async {
final request = TabularDataByMQLRequest()
..organizationId = organizationId
..mqlQuery = query;
..mqlBinary.addAll(query);
final response = await _dataClient.tabularDataByMQL(request);
return response.data.map((e) => e.toMap()).toList();
}
Expand Down
4 changes: 3 additions & 1 deletion test/unit_test/app/data_client_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:typed_data';

import 'package:fixnum/fixnum.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:grpc/src/client/call.dart';
Expand Down Expand Up @@ -145,7 +147,7 @@ void main() {
when(serviceClient.tabularDataByMQL(any))
.thenAnswer((_) => MockResponseFuture.value(TabularDataByMQLResponse()..data.addAll(data.map((e) => e.toStruct()))));

final response = await dataClient.tabularDataByMql('some_org_id', 'some_query');
final response = await dataClient.tabularDataByMql('some_org_id', [Uint8List.fromList('some_query'.codeUnits)]);
expect(response, equals(data));
});
});
Expand Down

0 comments on commit b52eaae

Please sign in to comment.