@temporary-escape/mod-sdk / Cursor
Abstract Class: Cursor<T extends Serializable>
Defined in: database/cursor.ts:9
Base class for cursors that iterate over documents.
Declared as an abstract class rather than an interface because AssemblyScript does not support accessor (get) signatures in interfaces.
Extended by
Type Parameters
| Type Parameter |
|---|
T extends Serializable |
Constructors
Constructor
ts
new Cursor<T extends Serializable>(): Cursor<T>;Returns
Cursor<T>
Accessors
key
Get Signature
ts
get abstract key(): number;Defined in: database/cursor.ts:35
Returns the key of the current document
Returns zero if the cursor is not valid.
Returns
number
value
Get Signature
ts
get abstract value(): T;Defined in: database/cursor.ts:43
Returns the document
Calling this multiple times returns the same document. To advance to the next document, you must call the next() function.
Returns
T
Methods
close()
ts
abstract close(): void;Defined in: database/cursor.ts:13
Closes the cursor
Returns
void
next()
ts
abstract next(): void;Defined in: database/cursor.ts:23
Advances the cursor to the next document
The cursor points to the first document when the cursor is created. You must call this function when you want to move to the next document (second or later).
You must check if the cursor is valid after calling this function.
Returns
void
valid()
ts
abstract valid(): boolean;Defined in: database/cursor.ts:28
Returns true if the cursor points to some valid document
Returns
boolean
