diff --git a/lib/datastore.dart b/lib/datastore.dart index 24ffb733..cf7eaac9 100644 --- a/lib/datastore.dart +++ b/lib/datastore.dart @@ -252,9 +252,21 @@ class FilterRelation { // ignore: constant_identifier_names static const FilterRelation LessThanOrEqual = FilterRelation._('<='); // ignore: constant_identifier_names - static const FilterRelation GreatherThan = FilterRelation._('>'); + static const FilterRelation GreaterThan = FilterRelation._('>'); + + /// Old misspelled name for [GreaterThan], retained for compatibility. + /// + /// @nodoc + @Deprecated('Use FilterRelation.GreaterThan instead') + static const FilterRelation GreatherThan = GreaterThan; // ignore: constant_identifier_names - static const FilterRelation GreatherThanOrEqual = FilterRelation._('>='); + static const FilterRelation GreaterThanOrEqual = FilterRelation._('>='); + + /// Old misspelled name for [GreaterThanOrEqual], retained for compatibility. + /// + /// @nodoc + @Deprecated('Use FilterRelation.GreaterThanOrEqual instead') + static const FilterRelation GreatherThanOrEqual = GreaterThanOrEqual; // ignore: constant_identifier_names static const FilterRelation Equal = FilterRelation._('=='); @@ -289,7 +301,13 @@ class OrderDirection { // ignore: constant_identifier_names static const OrderDirection Ascending = OrderDirection._('Ascending'); // ignore: constant_identifier_names - static const OrderDirection Decending = OrderDirection._('Decending'); + static const OrderDirection Descending = OrderDirection._('Descending'); + + /// Old misspelled name for [Descending], retained for compatibility. + /// + /// @nodoc + @Deprecated('Use OrderDirection.Descending instead') + static const OrderDirection Decending = Descending; final String name; diff --git a/lib/fix_data.yaml b/lib/fix_data.yaml new file mode 100644 index 00000000..976365ae --- /dev/null +++ b/lib/fix_data.yaml @@ -0,0 +1,29 @@ +version: 1 +transforms: + - title: 'Rename to Descending' + date: 2024-09-11 + element: + uris: ['datastore.dart'] + field: 'Decending' + inClass: 'OrderDirection' + changes: + - kind: 'rename' + newName: 'Descending' + - title: 'Rename to GreaterThan' + date: 2024-09-11 + element: + uris: ['datastore.dart'] + field: 'GreatherThan' + inClass: 'FilterRelation' + changes: + - kind: 'rename' + newName: 'GreaterThan' + - title: 'Rename to GreaterThanOrEqual' + date: 2024-09-11 + element: + uris: ['datastore.dart'] + field: 'GreatherThanOrEqual' + inClass: 'FilterRelation' + changes: + - kind: 'rename' + newName: 'GreaterThanOrEqual' diff --git a/lib/src/datastore_impl.dart b/lib/src/datastore_impl.dart index 25907566..4be5c499 100644 --- a/lib/src/datastore_impl.dart +++ b/lib/src/datastore_impl.dart @@ -205,8 +205,8 @@ class DatastoreImpl implements datastore.Datastore { datastore.FilterRelation.LessThan: 'LESS_THAN', datastore.FilterRelation.LessThanOrEqual: 'LESS_THAN_OR_EQUAL', datastore.FilterRelation.Equal: 'EQUAL', - datastore.FilterRelation.GreatherThan: 'GREATER_THAN', - datastore.FilterRelation.GreatherThanOrEqual: 'GREATER_THAN_OR_EQUAL', + datastore.FilterRelation.GreaterThan: 'GREATER_THAN', + datastore.FilterRelation.GreaterThanOrEqual: 'GREATER_THAN_OR_EQUAL', }; api.Filter _convertDatastore2ApiFilter(datastore.Filter filter) { diff --git a/lib/src/db/db.dart b/lib/src/db/db.dart index a6e51492..5c2f888f 100644 --- a/lib/src/db/db.dart +++ b/lib/src/db/db.dart @@ -143,8 +143,8 @@ class Query { final _relationMapping = const { '<': ds.FilterRelation.LessThan, '<=': ds.FilterRelation.LessThanOrEqual, - '>': ds.FilterRelation.GreatherThan, - '>=': ds.FilterRelation.GreatherThanOrEqual, + '>': ds.FilterRelation.GreaterThan, + '>=': ds.FilterRelation.GreaterThanOrEqual, '=': ds.FilterRelation.Equal, }; @@ -211,7 +211,7 @@ class Query { void order(String orderString) { // TODO: validate [orderString] (e.g. is name valid) if (orderString.startsWith('-')) { - _orders.add(ds.Order(ds.OrderDirection.Decending, + _orders.add(ds.Order(ds.OrderDirection.Descending, _convertToDatastoreName(orderString.substring(1)))); } else { _orders.add(ds.Order( diff --git a/test/datastore/e2e/datastore_test_impl.dart b/test/datastore/e2e/datastore_test_impl.dart index 549063e6..3163afef 100644 --- a/test/datastore/e2e/datastore_test_impl.dart +++ b/test/datastore/e2e/datastore_test_impl.dart @@ -780,7 +780,7 @@ void runTests(Datastore datastore, String? namespace) { assert(indexedEntity.length == 1); var filters = [ - Filter(FilterRelation.GreatherThan, queryKey, queryLowerBound), + Filter(FilterRelation.GreaterThan, queryKey, queryLowerBound), Filter(FilterRelation.LessThan, queryKey, queryUpperbound), ]; var listFilters = [ @@ -795,7 +795,7 @@ void runTests(Datastore datastore, String? namespace) { Filter(FilterRelation.Equal, testUnindexedProperty, queryIndexValue) ]; - var orders = [Order(OrderDirection.Decending, queryKey)]; + var orders = [Order(OrderDirection.Descending, queryKey)]; test('query', () async { await insert(stringNamedEntities, []);