Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dart 2 compatibility #11

Merged
merged 1 commit into from
Jun 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/src/modifier_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ ModifierBuilder get modify => new ModifierBuilder();

class ModifierBuilder{

Map map = {};
Map<String, dynamic> map = {};

toString() => "ModifierBuilder($map)";

void _updateOperation(String operator, String fieldName, value) {
Map opMap = map[operator];
Map<String, dynamic> opMap = map[operator];
if (opMap == null) {
opMap = {};
opMap = <String, dynamic>{};
map[operator] = opMap;
}
opMap[fieldName] = value;
Expand Down
24 changes: 12 additions & 12 deletions lib/src/selector_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ SelectorBuilder get where => new SelectorBuilder();
class SelectorBuilder {
static final RegExp objectIdRegexp =
new RegExp(".ObjectId...([0-9a-f]{24})....");
Map map = {};
Map<String, dynamic> map = {};
bool _isQuerySet = false;
Map get _query {
Map<String, dynamic> get _query {
if (!_isQuerySet) {
map['\$query'] = {};
map['\$query'] = <String, dynamic>{};
_isQuerySet = true;
}
return map['\$query'];
}

int paramSkip = 0;
int paramLimit = 0;
Map paramFields;
Map<String, dynamic> paramFields;

String toString() => "SelectorBuilder($map)";

_addExpression(String fieldName, value) {
Map exprMap = {};
Map<String, dynamic> exprMap = {};
exprMap[fieldName] = value;
if (_query.isEmpty) {
_query[fieldName] = value;
Expand All @@ -31,7 +31,7 @@ class SelectorBuilder {
}
}

_addExpressionMap(Map expr) {
_addExpressionMap(Map<String, dynamic> expr) {
if (_query.containsKey('\$and')) {
List expressions = _query['\$and'];
expressions.add(expr);
Expand All @@ -44,14 +44,14 @@ class SelectorBuilder {

void _ensureParamFields() {
if (paramFields == null) {
paramFields = {};
paramFields = <String, dynamic>{};
}
}

void _ensureOrderBy() {
_query;
if (!map.containsKey("orderby")) {
map["orderby"] = new LinkedHashMap();
map["orderby"] = <String, dynamic>{};
}
}

Expand Down Expand Up @@ -136,7 +136,7 @@ class SelectorBuilder {

SelectorBuilder inRange(String fieldName, min, max,
{bool minInclude: true, bool maxInclude: false}) {
Map rangeMap = {};
Map<String, dynamic> rangeMap = {};
if (minInclude) {
rangeMap["\$gte"] = min;
} else {
Expand All @@ -163,14 +163,14 @@ class SelectorBuilder {

SelectorBuilder sortByMetaTextScore(String fieldName) {
_ensureOrderBy();
map["orderby"][fieldName] = {'\$meta': "textScore"};
map["orderby"][fieldName] = <String, dynamic>{'\$meta': "textScore"};
return this;
}

SelectorBuilder hint(String fieldName, {bool descending: false}) {
_query;
if (!map.containsKey("\$hint")) {
map["\$hint"] = new LinkedHashMap();
map["\$hint"] = <String, dynamic>{};
}
int order = 1;
if (descending) {
Expand Down Expand Up @@ -254,7 +254,7 @@ class SelectorBuilder {
return this;
}

SelectorBuilder raw(Map rawSelector) {
SelectorBuilder raw(Map<String, dynamic> rawSelector) {
map = rawSelector;
return this;
}
Expand Down