@temporary-escape/mod-sdk / IndexCursor
Class: IndexCursor<T extends Serializable>
Defined in: database/index-cursor.ts:37
A cursor that iterates over the documents matching an index lookup.
The cursor points to the first matching document when it is created.
You MUST call the close() method when you are done with the cursor to free up resources. Not closing the cursor will result in a memory leak!!!
Extends
Cursor<T>
Type Parameters
| Type Parameter |
|---|
T extends Serializable |
Constructors
Constructor
ts
new IndexCursor<T extends Serializable>(handle: number, factory: () => T): IndexCursor<T>;Defined in: database/index-cursor.ts:38
Parameters
| Parameter | Type |
|---|---|
handle | number |
factory | () => T |
Returns
IndexCursor<T>
Overrides
Accessors
key
Get Signature
ts
get key(): number;Defined in: database/index-cursor.ts:87
Returns the id of the current document
Returns zero if the cursor is not valid.
Returns
number
Overrides
value
Get Signature
ts
get value(): T;Defined in: database/index-cursor.ts:98
Returns the current document
Calling this multiple times returns the same document. To advance to the next document, you must call the next() function.
Returns
T
Overrides
Methods
close()
ts
close(): void;Defined in: database/index-cursor.ts:47
Closes the cursor
Returns
void
Overrides
next()
ts
next(): void;Defined in: database/index-cursor.ts:59
Advances the cursor to the next matching document
The cursor points to the first matching document when it is created. You must check if the cursor is valid after calling this function.
Returns
void
Overrides
seekToLast()
ts
seekToLast(): void;Defined in: database/index-cursor.ts:69
Goes to the last matching document.
You must check if the cursor is valid after calling this function.
Returns
void
valid()
ts
valid(): boolean;Defined in: database/index-cursor.ts:77
Returns true if the cursor points to a valid document
Returns
boolean
