Index: pkg/gcloud/lib/src/db/model_db.dart |
diff --git a/pkg/gcloud/lib/src/db/model_db.dart b/pkg/gcloud/lib/src/db/model_db.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0655ac3ad8c8faf3c0da4b18f02a7c6064e95d35 |
--- /dev/null |
+++ b/pkg/gcloud/lib/src/db/model_db.dart |
@@ -0,0 +1,43 @@ |
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+part of gcloud.db; |
+ |
+/** |
+ * A database of all registered models. |
+ * |
+ * Responsible for converting between dart model objects and datastore entities. |
+ */ |
+abstract class ModelDB { |
+ /** |
+ * Converts a [datastore.Key] to a [Key]. |
+ */ |
+ Key fromDatastoreKey(datastore.Key datastoreKey); |
+ |
+ /** |
+ * Converts a [Key] to a [datastore.Key]. |
+ */ |
+ datastore.Key toDatastoreKey(Key dbKey); |
+ |
+ /** |
+ * Converts a [Model] instance to a [datastore.Entity]. |
+ */ |
+ datastore.Entity toDatastoreEntity(Model model) ; |
+ |
+ /** |
+ * Converts a [datastore.Entity] to a [Model] instance. |
+ */ |
+ Model fromDatastoreEntity(datastore.Entity entity); |
+ |
+ /** |
+ * Returns the kind name for instances of [type]. |
+ */ |
+ String kindName(Type type); |
+ |
+ /** |
+ * Returns the property name used for [fieldName] |
+ */ |
+ // TODO: Get rid of this eventually. |
+ String fieldNameToPropertyName(String kind, String fieldName); |
+} |