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 request = _openCursor(key_OR_range); | 60 // FIXME: Passing in "next" should be unnecessary. |
| 61 request = _openCursor(key_OR_range, "next"); |
61 } else { | 62 } else { |
62 request = _openCursor(key_OR_range, direction); | 63 request = _openCursor(key_OR_range, direction); |
63 } | 64 } |
64 return ObjectStore._cursorStreamFromResult(request, autoAdvance); | 65 return ObjectStore._cursorStreamFromResult(request, autoAdvance); |
65 } | 66 } |
66 | 67 |
67 /** | 68 /** |
68 * Creates a stream of cursors over the records in this object store. | 69 * Creates a stream of cursors over the records in this object store. |
69 * | 70 * |
70 * See also: | 71 * See also: |
71 * | 72 * |
72 * * [ObjectStore.openCursor] | 73 * * [ObjectStore.openCursor] |
73 */ | 74 */ |
74 Stream<Cursor> openKeyCursor({key, KeyRange range, String direction, | 75 Stream<Cursor> openKeyCursor({key, KeyRange range, String direction, |
75 bool autoAdvance}) { | 76 bool autoAdvance}) { |
76 var key_OR_range = null; | 77 var key_OR_range = null; |
77 if (key != null) { | 78 if (key != null) { |
78 if (range != null) { | 79 if (range != null) { |
79 throw new ArgumentError('Cannot specify both key and range.'); | 80 throw new ArgumentError('Cannot specify both key and range.'); |
80 } | 81 } |
81 key_OR_range = key; | 82 key_OR_range = key; |
82 } else { | 83 } else { |
83 key_OR_range = range; | 84 key_OR_range = range; |
84 } | 85 } |
85 var request; | 86 var request; |
86 if (direction == null) { | 87 if (direction == null) { |
87 request = _openKeyCursor(key_OR_range); | 88 // FIXME: Passing in "next" should be unnecessary. |
| 89 request = _openKeyCursor(key_OR_range, "next"); |
88 } else { | 90 } else { |
89 request = _openKeyCursor(key_OR_range, direction); | 91 request = _openKeyCursor(key_OR_range, direction); |
90 } | 92 } |
91 return ObjectStore._cursorStreamFromResult(request, autoAdvance); | 93 return ObjectStore._cursorStreamFromResult(request, autoAdvance); |
92 } | 94 } |
93 | 95 |
94 $!MEMBERS | 96 $!MEMBERS |
95 } | 97 } |
OLD | NEW |