<protected> new Query(conn, config, locator)
Query (extends RecordStream implements Receivable)
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
conn |
Connection | Connection object | |
config |
Object | String | Query config object or SOQL string | |
locator |
String |
<optional> |
Locator string to fetch next record set |
Extends
Classes
Methods
-
autoFetch(autoFetch) → {Query.<T>}
-
Switching auto fetch mode
Parameters:
Name Type Description autoFetch
Boolean Using auto fetch mode or not Returns:
- Type
- Query.<T>
-
close()
-
Closing query. No operation for query is allowed after closing.
-
del(type, callback) → {Bulk~Batch}
-
Synonym of Query#destroy()
Parameters:
Name Type Argument Description type
String <optional>
SObject type. Required for SOQL based query object. callback
Callback.<Array.<RecordResult>> <optional>
Callback function Returns:
- Type
- Bulk~Batch
-
delete(type, callback) → {Bulk~Batch}
-
Synonym of Query#destroy()
Parameters:
Name Type Argument Description type
String <optional>
SObject type. Required for SOQL based query object. callback
Callback.<Array.<RecordResult>> <optional>
Callback function Returns:
- Type
- Bulk~Batch
-
destroy(type, callback) → {Bulk~Batch}
-
Bulk delete queried records
Parameters:
Name Type Argument Description type
String <optional>
SObject type. Required for SOQL based query object. callback
Callback.<Array.<RecordResult>> <optional>
Callback function Returns:
- Type
- Bulk~Batch
-
destroySoon()
-
Destroy record stream after all record submission in the queue;
- Inherited From:
- Source:
-
end()
-
End sending records into stream.
- Inherited From:
- Source:
-
exec(options, callback) → {Query.<T>}
-
Synonym of Query#execute()
Parameters:
Name Type Argument Description options
Object <optional>
Query options Properties
Name Type Argument Description autoFetch
Boolean <optional>
Using auto fetch mode or not maxFetch
Number <optional>
Max fetching records in auto fetch mode callback
Callback.<T> <optional>
Callback function Returns:
- Type
- Query.<T>
-
execute(options, callback) → {Query.<T>}
-
Execute query and fetch records from server.
Parameters:
Name Type Argument Description options
Object <optional>
Query options Properties
Name Type Argument Description autoFetch
Boolean <optional>
Using auto fetch mode or not maxFetch
Number <optional>
Max fetching records in auto fetch mode callback
Callback.<T> <optional>
Callback function Returns:
- Type
- Query.<T>
-
filter(fn) → {RecordStream}
-
Filtering incoming record from upstream, and pass to downstream
Parameters:
Name Type Description fn
RecordFilterFunction Record filtering function - Inherited From:
- Source:
Returns:
- Type
- RecordStream
-
include(childRelName, conditions, fields, options) → {Query~SubQuery}
-
Include child relationship query
Parameters:
Name Type Argument Description childRelName
String Child relationship name to include in query result conditions
Object | String <optional>
Conditions in JSON object (MongoDB-like), or raw SOQL WHERE clause string. fields
Object | Array.<String> | String <optional>
Fields to fetch. Format can be in JSON object (MongoDB-like), array of field names, or comma-separated field names. options
Object <optional>
Query options. Properties
Name Type Argument Description limit
Number <optional>
Maximum number of records the query will return. offset
Number <optional>
Offset number where begins returning results. skip
Number <optional>
Synonym of options.offset. Returns:
- Type
- Query~SubQuery
-
limit(limit) → {Query.<T>}
-
Limit the returning result
Parameters:
Name Type Description limit
Number Maximum number of records the query will return. Returns:
- Type
- Query.<T>
-
map(fn) → {RecordStream}
-
Mapping incoming record from upstream, and pass to downstream
Parameters:
Name Type Description fn
RecordMapFunction Record mapping function - Inherited From:
- Source:
Returns:
- Type
- RecordStream
-
maxFetch(maxFetch) → {Query.<T>}
-
Setting maxFetch query option
Parameters:
Name Type Description maxFetch
Number Max fetching records in auto fetch mode Returns:
- Type
- Query.<T>
-
offset(offset) → {Query.<T>}
-
Synonym of Query#skip()
Parameters:
Name Type Description offset
Number Offset number where begins returning results. Returns:
- Type
- Query.<T>
-
offset(offset) → {Query.<T>}
-
Skip records
Parameters:
Name Type Description offset
Number Offset number where begins returning results. Returns:
- Type
- Query.<T>
-
pause()
-
Pause record fetch
-
pipe()
-
Auto start query when pipe() is called.
-
resume()
-
Resume record fetch and query execution
-
run(options, callback) → {Query.<T>}
-
Synonym of Query#execute()
Parameters:
Name Type Argument Description options
Object <optional>
Query options Properties
Name Type Argument Description autoFetch
Boolean <optional>
Using auto fetch mode or not maxFetch
Number <optional>
Max fetching records in auto fetch mode callback
Callback.<T> <optional>
Callback function Returns:
- Type
- Query.<T>
-
scanAll(scanAll) → {Query.<T>}
-
Set flag to scan all records including deleted and archived.
Parameters:
Name Type Description scanAll
Boolean Flag whether include deleted/archived record or not. Default is false. Returns:
- Type
- Query.<T>
-
select(fields) → {Query.<T>}
-
Select fields to include in the returning result
Parameters:
Name Type Description fields
Object | Array.<String> | String Fields to fetch. Format can be in JSON object (MongoDB-like), array of field names, or comma-separated field names. Returns:
- Type
- Query.<T>
-
send(record)
-
Output record into stream.
Parameters:
Name Type Description record
Record Record object - Inherited From:
- Source:
-
<protected> setResponseTarget(responseTarget) → {Query.<S>}
-
Parameters:
Name Type Description responseTarget
String Query response target Returns:
- Type
- Query.<S>
-
sort(sort, dir) → {Query.<T>}
-
Set query sort with direction
Parameters:
Name Type Argument Description sort
String | Object Sorting field or hash object with field name and sord direction dir
String | Number <optional>
Sorting direction (ASC|DESC|1|-1) Returns:
- Type
- Query.<T>
-
stream() → {stream.Stream}
-
Create Node.js stream instance for serializing/deserialize records
- Inherited From:
- Source:
Returns:
- Type
- stream.Stream
-
then(onFulfilled, onRejected) → {Promise.<(S1|S2)>}
-
Promise/A+ interface http://promises-aplus.github.io/promises-spec/ Delegate to deferred promise, return promise instance for query result
Parameters:
Name Type Argument Description onFulfilled
FulfilledCallback.<T, S1> <optional>
onRejected
RejectedCallback.<S2> <optional>
Returns:
- Type
- Promise.<(S1|S2)>
-
thenCall(callback) → {Promise.<T>}
-
Promise/A+ extension Call "then" using given node-style callback function
Parameters:
Name Type Argument Description callback
Callback.<T> <optional>
Callback function Returns:
- Type
- Promise.<T>
-
update(mapping, type, callback) → {Bulk~Batch}
-
Bulk update queried records, using given mapping function/object
Parameters:
Name Type Argument Description mapping
Record | RecordMapFunction Mapping record or record mapping function type
String <optional>
SObject type. Required for SOQL based query object. callback
Callback.<Array.<RecordResult>> <optional>
Callback function Returns:
- Type
- Bulk~Batch
-
where(conditions) → {Query.<T>}
-
Set query conditions to filter the result records
Parameters:
Name Type Description conditions
Object | String Conditions in JSON object (MongoDB-like), or raw SOQL WHERE clause string. Returns:
- Type
- Query.<T>