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>
0The total number of objects available to the request. If not specified the count of data objects is used.
-
affected
Number
<optional>
0The number of objects affected in storage.
-
returned
Number
<optional>
0The number of objects returned from storage.
-
code
Number
<optional>
200Optional 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
codeNumber
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
empty() → {Response}
Returns an empty response with no objects and a total of 0.
Returns
Source
one() → {M}
Returns the first data record from the response. If no data records are present, null is returned.
Returns
-
M