OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
6 | 6 |
7 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
{ | 7 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
{ |
8 @DomName('IDBIndex.count') | 8 @DomName('IDBIndex.count') |
9 Future<int> count([key_OR_range]) { | 9 Future<int> count([key_OR_range]) { |
10 try { | 10 try { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 if (key != null) { | 50 if (key != null) { |
51 if (range != null) { | 51 if (range != null) { |
52 throw new ArgumentError('Cannot specify both key and range.'); | 52 throw new ArgumentError('Cannot specify both key and range.'); |
53 } | 53 } |
54 key_OR_range = key; | 54 key_OR_range = key; |
55 } else { | 55 } else { |
56 key_OR_range = range; | 56 key_OR_range = range; |
57 } | 57 } |
58 var request; | 58 var request; |
59 if (direction == null) { | 59 if (direction == null) { |
60 // FIXME: Passing in "next" should be unnecessary. | 60 request = _openCursor(key_OR_range); |
61 request = _openCursor(key_OR_range, "next"); | |
62 } else { | 61 } else { |
63 request = _openCursor(key_OR_range, direction); | 62 request = _openCursor(key_OR_range, direction); |
64 } | 63 } |
65 return ObjectStore._cursorStreamFromResult(request, autoAdvance); | 64 return ObjectStore._cursorStreamFromResult(request, autoAdvance); |
66 } | 65 } |
67 | 66 |
68 /** | 67 /** |
69 * Creates a stream of cursors over the records in this object store. | 68 * Creates a stream of cursors over the records in this object store. |
70 * | 69 * |
71 * See also: | 70 * See also: |
72 * | 71 * |
73 * * [ObjectStore.openCursor] | 72 * * [ObjectStore.openCursor] |
74 */ | 73 */ |
75 Stream<Cursor> openKeyCursor({key, KeyRange range, String direction, | 74 Stream<Cursor> openKeyCursor({key, KeyRange range, String direction, |
76 bool autoAdvance}) { | 75 bool autoAdvance}) { |
77 var key_OR_range = null; | 76 var key_OR_range = null; |
78 if (key != null) { | 77 if (key != null) { |
79 if (range != null) { | 78 if (range != null) { |
80 throw new ArgumentError('Cannot specify both key and range.'); | 79 throw new ArgumentError('Cannot specify both key and range.'); |
81 } | 80 } |
82 key_OR_range = key; | 81 key_OR_range = key; |
83 } else { | 82 } else { |
84 key_OR_range = range; | 83 key_OR_range = range; |
85 } | 84 } |
86 var request; | 85 var request; |
87 if (direction == null) { | 86 if (direction == null) { |
88 // FIXME: Passing in "next" should be unnecessary. | 87 request = _openKeyCursor(key_OR_range); |
89 request = _openKeyCursor(key_OR_range, "next"); | |
90 } else { | 88 } else { |
91 request = _openKeyCursor(key_OR_range, direction); | 89 request = _openKeyCursor(key_OR_range, direction); |
92 } | 90 } |
93 return ObjectStore._cursorStreamFromResult(request, autoAdvance); | 91 return ObjectStore._cursorStreamFromResult(request, autoAdvance); |
94 } | 92 } |
95 | 93 |
96 $!MEMBERS | 94 $!MEMBERS |
97 } | 95 } |
OLD | NEW |