Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Unified Diff: pkg/gcloud/lib/db.dart

Issue 804973002: Add appengine/gcloud/mustache dependencies. (Closed) Base URL: git@github.com:dart-lang/pub-dartlang-dart.git@master
Patch Set: Added AUTHORS/LICENSE/PATENTS files Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/gcloud/lib/datastore.dart ('k') | pkg/gcloud/lib/db/metamodel.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/gcloud/lib/db.dart
diff --git a/pkg/gcloud/lib/db.dart b/pkg/gcloud/lib/db.dart
new file mode 100644
index 0000000000000000000000000000000000000000..7c5feb2ec1ea3a8e6b7ea67eaa04b1c0ce4f56ed
--- /dev/null
+++ b/pkg/gcloud/lib/db.dart
@@ -0,0 +1,41 @@
+// 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.
+
+library gcloud.db;
+
+import 'dart:async';
+import 'dart:collection';
+import 'dart:mirrors' as mirrors;
+
+import 'common.dart' show Page, StreamFromPages;
+import 'service_scope.dart' as ss;
+import 'datastore.dart' as datastore;
+
+part 'src/db/annotations.dart';
+part 'src/db/db.dart';
+part 'src/db/models.dart';
+part 'src/db/model_db.dart';
+part 'src/db/model_db_impl.dart';
+
+const Symbol _dbKey = #_gcloud.db;
+
+/// Access the [DatastoreDB] object available in the current service scope.
+///
+/// The returned object will be the one which was previously registered with
+/// [registerDbService] within the current (or a parent) service scope.
+///
+/// Accessing this getter outside of a service scope will result in an error.
+/// See the `package:gcloud/service_scope.dart` library for more information.
+DatastoreDB get dbService => ss.lookup(_dbKey);
+
+/// Registers the [DatastoreDB] object within the current service scope.
+///
+/// The provided `db` object will be avilable via the top-level `db` getter.
+///
+/// Calling this function outside of a service scope will result in an error.
+/// Calling this function more than once inside the same service scope is not
+/// allowed.
+void registerDbService(DatastoreDB db) {
+ ss.register(_dbKey, db);
+}
« no previous file with comments | « pkg/gcloud/lib/datastore.dart ('k') | pkg/gcloud/lib/db/metamodel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698