Commit 90c9335
Changed files (4)
health_data_store
lib
src
data_providers
repositories
health_data_store/lib/src/data_providers/data_provider.dart
@@ -1,21 +0,0 @@
-import 'dart:collection';
-
-import 'package:health_data_store/health_data_store.dart';
-
-/// A data provider provides access to the data.
-///
-/// It interacts with the databases on a low level and only supports basic CRUD
-/// operations.
-///
-/// Tables are structured in a way that they have a id ([int]) as a primary
-/// key and have one or more other columns associated with that key.
-abstract class DataProvider<T> {
- /// Gets all entries in the inclusive range.
- Future<UnmodifiableListView<(int,T)>> getInRange(DateRange range);
-
- /// Sets the data at [entryID] to [value].
- Future<void> set(int entryID, T value);
-
- /// Removes the value associated with this [entryID].
- Future<void> remove(int entryID);
-}
health_data_store/lib/src/repositories/meta_repository.dart
@@ -0,0 +1,25 @@
+import 'package:health_data_store/src/types/date_range.dart';
+
+/// The meta repository contains metadata about the stored data.
+///
+/// This includes data such as ranges in which events exist and what type of
+/// data was collected during a event.
+class MetaRepository {
+ DateRange get availableRange {
+ // TODO
+ throw UnimplementedError();
+ }
+
+ DateTime get firstEntry {
+ // TODO
+ throw UnimplementedError();
+ }
+
+ DateRange get lastEntry {
+ // TODO
+ throw UnimplementedError();
+ }
+
+ // TODO: check what is needed
+
+}
health_data_store/lib/src/repositories/repository.dart
@@ -1,11 +1,11 @@
import 'dart:collection';
-import 'package:health_data_store/src/data_providers/data_provider.dart';
+import 'package:health_data_store/src/database_manager.dart';
import 'package:health_data_store/src/types/date_range.dart';
-/// A repository is a abstraction around multiple [DataProvider]s.
+/// A repository is a abstraction around the [DatabaseManager]
///
-/// Repositories wrap the primitive values of [DataProvider]s into more complex
+/// Repositories wrap the primitive values of DB fields into more complex
/// types and provides domain models for the application.
abstract class Repository<T> {
/// Adds a new value to the repository.
health_data_store/lib/src/health_data_store.dart
@@ -3,12 +3,12 @@ import 'package:sqflite_common/sqflite.dart';
// TODO: document once finished
abstract class HealthDataStore {
-
const HealthDataStore._create();
/// Initializes objects from [db].
///
- /// [db] must be exclusive to the package and will be initialized by it.
+ /// [db] must be exclusive to the package and will be initialized by it. The
+ /// library maintains the version and is responsible for update operations.
static Future<HealthDataStore?> load(Database db) async {
if (!db.isOpen) return null;
// TODO