@AppKu/StashKu

@AppKu/StashKu

v1.0.46

Class

Response

A standard response from a StashKu storage engine that completes a request.

Constructor

new Response(data, totalopt, affectedopt, returnedopt, codeopt)

Creates a standard response of the data returned by a StashKu storage engine.

Parameters

  • data Array.<M>

    The data to be returned to the requesting caller.

  • total Number <optional>
    0

    The total number of objects available to the request. If not specified the count of data objects is used.

  • affected Number <optional>
    0

    The number of objects affected in storage.

  • returned Number <optional>
    0

    The number of objects returned from storage.

  • code Number <optional>
    200

    Optional status code to include as part of the response. If you are returning an error, consider throwing a RestError instead.

Source

Members

affectedNumber

The number of objects or values affected (altered/touched/created) in storage as a result of the request.

This number is always 0 for GET requests.

Type

  • Number

Source

dataArray.<M>

An array of the objects or values resulting from the request to the engine.

Type

  • Array.<M>

Source

returnedNumber

The number of objects or values to be returned from the engine as a result of the request.

This number will be populated on GET requests utilizing the .count() flag, even though no objects are returned in data.

Type

  • Number

Source

totalNumber

The number of objects or values available (i.e. resulting from) the request query in consideration of any where conditions, but disregarding any skip and take paging limitations.

Type

  • Number

Source

Methods

one() → {M}

Returns the first data record from the response. If no data records are present, null is returned.

Returns

  • M

Source