Skip to content

Commit

Permalink
feat: add onKeys, onKeysSync and delete to CvQueryRef
Browse files Browse the repository at this point in the history
  • Loading branch information
alextekartik committed Feb 3, 2025
1 parent ecae4d4 commit da62038
Show file tree
Hide file tree
Showing 28 changed files with 60 additions and 29 deletions.
2 changes: 1 addition & 1 deletion app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ homepage: https://www.example.com
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
pub_semver: ">=2.1.4"
Expand Down
4 changes: 2 additions & 2 deletions app_archive/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ homepage: https://github.com/tekartik/app_common_utils.dart
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
archive: ">=3.6.1"
Expand All @@ -22,4 +22,4 @@ dev_dependencies:
build_runner: ">=2.4.13"
build_test:
dependency_overrides:
archive: ">=4.0.1"
archive: ">=4.0.1"
2 changes: 1 addition & 1 deletion app_bloc/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 0.2.0
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
tekartik_common_utils:
Expand Down
2 changes: 1 addition & 1 deletion app_crypto/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ homepage: https://www.example.com
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
tekartik_common_utils:
Expand Down
2 changes: 1 addition & 1 deletion app_csv/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ homepage: https://github.com/tekartik/app_common_utils.dart
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
csv: '>=5.0.0-0'
Expand Down
2 changes: 1 addition & 1 deletion app_cv_firestore/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Firestore content values helper
version: 1.0.0
publish_to: none
environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
meta: ">=1.15.0"
Expand Down
19 changes: 19 additions & 0 deletions app_cv_sembast/lib/src/cv_query_ref.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,23 @@ extension CvQueryRefExt<K, V extends DbRecord<K>> on CvQueryRef<K, V> {

/// onCountSync
Stream<int> onCountSync(Database db) => rawRef.onCountSync(db);

/// Delete
Future<int> delete(DatabaseClient db) => rawRef.delete(db);

/// Get keys
Future<List<K>> getKeys(DatabaseClient db) async {
return (await rawRef.getKeys(db));
}

/// Get keys
List<K> getKeysSync(DatabaseClient db) {
return (rawRef.getKeysSync(db));
}

/// onKeys
Stream<List<K>> onKeys(Database db) => rawRef.onKeys(db);

/// onKeysSync
Stream<List<K>> onKeysSync(Database db) => rawRef.onKeysSync(db);
}
4 changes: 2 additions & 2 deletions app_cv_sembast/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Sembast content values helper
version: 1.2.2
publish_to: none
environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
meta: ">=1.15.0"
Expand All @@ -13,7 +13,7 @@ dependencies:
url: https://github.com/tekartik/common_utils.dart
ref: dart3a
version: '>=0.11.1'
sembast: ">=3.8.1-4"
sembast: ">=3.8.3"
# sembast:
dev_dependencies:
test: ">=1.24.0"
Expand Down
12 changes: 12 additions & 0 deletions app_cv_sembast/test/app_cv_sembast_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,18 @@ void main() {
expect(records, hasLength(2));
await subscription.cancel();
});
test('delete', () async {
var cvStore = cvIntStoreFactory.store<DbTest>('test');
await db.transaction((txn) async {
await cvStore.record(1).cv().put(db);
await cvStore.record(2).cv().put(db);
await cvStore.record(3).cv().put(db);
var query = cvStore.query(
finder: Finder(sortOrders: [SortOrder(Field.key)], offset: 1));
expect(await query.delete(txn), 2);
expect(cvStore.query().getKeysSync(txn), [1]);
});
});
});
});
}
Expand Down
2 changes: 1 addition & 1 deletion app_date/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Date utilities
version: 0.1.6
publish_to: none
environment:
sdk: ^3.5.0
sdk: ^3.6.0

# Add regular dependencies here.
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion app_emit/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ homepage: https://www.example.com
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
cv: ">=1.1.0+4"
Expand Down
2 changes: 1 addition & 1 deletion app_http/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 0.2.0
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
tekartik_http_browser:
Expand Down
2 changes: 1 addition & 1 deletion app_intl/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 0.2.3
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
args: ">=2.6.0"
Expand Down
2 changes: 1 addition & 1 deletion app_json_schema/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 1.0.0
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

# Add regular dependencies here.
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion app_lints/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 0.1.0
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
cv: ">=1.1.0+4"
Expand Down
2 changes: 1 addition & 1 deletion app_media/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 1.0.0
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

# Add regular dependencies here.
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion app_mirrors/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homepage: https://github.com/tekartik/app_common_utils.dart/app_mirrors
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
tekartik_common_utils:
Expand Down
2 changes: 1 addition & 1 deletion app_pager/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ homepage: https://www.example.com
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
cv: ">=1.1.0+4"
Expand Down
2 changes: 1 addition & 1 deletion app_prefs/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 0.4.2
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
tekartik_prefs_sembast:
Expand Down
4 changes: 2 additions & 2 deletions app_rx/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 0.2.0
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
rxdart: '>=0.28.0'
Expand All @@ -30,4 +30,4 @@ dependency_overrides:
tekartik_app_bloc:
path: ../app_bloc
tekartik_app_common_utils:
path: ../app
path: ../app
2 changes: 1 addition & 1 deletion app_rx_bloc/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 0.2.0
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
tekartik_app_bloc:
Expand Down
2 changes: 1 addition & 1 deletion app_sembast/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 0.1.0
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
tekartik_app_sqflite:
Expand Down
2 changes: 1 addition & 1 deletion app_sembast_firestore_type_adapters/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ version: 0.1.0
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
sembast: ">=3.7.4+3"
Expand Down
2 changes: 1 addition & 1 deletion app_sembast_secure/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 0.1.0
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
tekartik_app_sembast:
Expand Down
2 changes: 1 addition & 1 deletion app_serialize/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homepage: https://github.com/tekartik/app_common_utils.dart/app_serialize
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
tekartik_app_mirrors:
Expand Down
2 changes: 1 addition & 1 deletion app_sqflite/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 0.6.1
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
sqflite_common_ffi_web: '>=0.4.0'
Expand Down
2 changes: 1 addition & 1 deletion app_web_socket/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 0.1.0
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
tekartik_web_socket_io:
Expand Down
2 changes: 1 addition & 1 deletion repo_support/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ publish_to: none
deploy_to: none

environment:
sdk: ^3.5.0
sdk: ^3.6.0

dependencies:
path: ">=1.9.0"
Expand Down

0 comments on commit da62038

Please sign in to comment.