# Class: Cursor

## Cursor

Class representing a cursor to obtain results of SQL and Scan query operations.

The class has no public constructor. An instance of this class is obtained via query() method of CacheClient objects. One instance of this class returns results of one SQL or Scan query operation.

Source:
  - Cursor.js, line 35

### Methods

#### (async) close()

Closes the cursor. Obtaining elements from the results is not possible after this.

This method should be called if no more elements are needed. It is not neccessary to call it if all elements have been already obtained.

Source:
  - Cursor.js, line 101

#### (async) getAll() → {Promise.<Array.<CacheEntry>>}

Returns all elements (cache entries - key-value pairs) from the query results.

May be used instead of getValue() method if the number of returned entries is relatively small and will not cause memory utilization issues.

Source:
  - Cursor.js, line 81

##### Returns:

- all cache entries (key-value pairs) returned by SQL or Scan query.

Type
  Promise.<Array.<CacheEntry>>

#### (async) getValue() → {Promise.<CacheEntry>}

Returns one element (cache entry - key-value pair) from the query results.

Every new call returns the next cache entry from the query results. If the method returns null, no more entries are available.

Source:
  - Cursor.js, line 47

##### Returns:

- a cache entry (key-value pair).

Type
  Promise.<CacheEntry>

#### hasMore() → {boolean}

Checks if more elements are available in the query results.

Source:
  - Cursor.js, line 65

##### Returns:

- true if more cache entries are available, false otherwise.

Type
  boolean