Skip to content
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.

Spelling api #193

Merged
merged 2 commits into from
Sep 11, 2024
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
24 changes: 21 additions & 3 deletions lib/datastore.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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._('==');

Expand Down Expand Up @@ -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;

Expand Down
29 changes: 29 additions & 0 deletions lib/fix_data.yaml
Original file line number Diff line number Diff line change
@@ -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'
4 changes: 2 additions & 2 deletions lib/src/datastore_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions lib/src/db/db.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ class Query<T extends Model> {
final _relationMapping = const <String, ds.FilterRelation>{
'<': ds.FilterRelation.LessThan,
'<=': ds.FilterRelation.LessThanOrEqual,
'>': ds.FilterRelation.GreatherThan,
'>=': ds.FilterRelation.GreatherThanOrEqual,
'>': ds.FilterRelation.GreaterThan,
'>=': ds.FilterRelation.GreaterThanOrEqual,
'=': ds.FilterRelation.Equal,
};

Expand Down Expand Up @@ -211,7 +211,7 @@ class Query<T extends Model> {
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(
Expand Down
4 changes: 2 additions & 2 deletions test/datastore/e2e/datastore_test_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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, <Entity>[]);
Expand Down