K - The type of the key used to identify objects into the cursor.V - The type of the objects referenced by this cursorpublic interface Cursor<K,V>
Represents a Cursor into Crux Database. Cursors can be used to iterate over the result of a database query.
To open a cursor, you must ask to an ObjectStore or an Index object. Both classes define an openCursor method.
See the following example:
Transactiontransaction = database.getTransaction(new String[]{"MyObjectStore"}, Mode.readOnly);ObjectStorestore = transaction.getObjectStore("MyObjectStore"); store.openCursor(newDatabaseCursorCallback<Integer, MyObject>(){ public void onSuccess( result) { if (result != null && result.getValue() != null) { Window.alert("Object found. ID ["+result.getKey()+"]"); continueCusror(); } } });
| Modifier and Type | Interface and Description |
|---|---|
static class |
Cursor.CursorDirection
Direction for the cursor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
advance(int count)
Advance the cursor current position by a number of positions.
|
void |
continueCursor()
Make cursor to go to the next element.
|
void |
continueCursor(K key)
Make cursor to go to the element referenced by the given key.
|
void |
delete()
Delete the current value, pointed by the cursor, from the database.
|
Cursor.CursorDirection |
getDirection()
Direction of iteration used by this cursor.
|
K |
getKey()
Return the key of record pointed by the cursor.
|
com.google.gwt.core.client.JsArrayMixed |
getNativeArrayKey()
Return the cursor key, as a native javascript object.
|
V |
getValue()
Return the value of record pointed by the cursor.
|
boolean |
hasValue()
Return true if cursor points to a valid value.
|
void |
update(V value)
Update current record pointed by the cursor with the given value.
|
void advance(int count)
count - number of items to advancevoid continueCursor()
void continueCursor(K key)
key - key of the element to be pointed by the cursor.void delete()
boolean hasValue()
Cursor.CursorDirection getDirection()
com.google.gwt.core.client.JsArrayMixed getNativeArrayKey()
void update(V value)
value - new value to updateK getKey()
V getValue()
Copyright © 2015. All rights reserved.