Class: Query

LiveView. Query

new LiveView.Query(query, parameters, includeInternal)

Object that represents a LiveView query. This object is used as a parameter when calling execute or {@link LiveView.Connection.subscribe|subscribe}. It stores the query string (in parameterized format) as well as the parameters to apply when invoking execute or subscribe.
Name Type Description
query String The optionally-parametrized query string
parameters Object optional A key-value map of parameters to use to compute the query string, if query is a parametrized string. Users are essentially free to define the key value used to identify a parameter as they wish. The query string is generated using regular expression substitution, so avoidance of regular expression special characters is recommended as it will likely cause unexpected behavior. The '@' character as a parameter prefix works well (e.g. {'@priceMin':100, '@lastUpdated':1415230518223}).
includeInternal boolean optional A flag indicating whether or not to include internal fields in (non-aggregate) query results.

Members

queryString

The query string in parametrized form. For example: "Select * From ItemsSales Where lastSoldPrice > @minPrice"

parametersObject

A key-value map of parameters to use to compute the query string, if query is a parametrized string. Users are essentially free to define the key value used to identify a parameter as they wish. The query string is generated using regular expression substitution, so avoidance of regular expression special characters is recommended as it will likely cause unexpected behavior. The '@' character as a parameter prefix works well (e.g. {'@priceMin':100, '@lastUpdated':1415230518223}).

includeInternalboolean

A flag indicating whether or not to include internal fields in (non-aggregate) query results.

Methods

getQueryString(){String}

Applies parameters to the query and returns the resulting query string. If this is not a parametrized query, this will be equivalent to the query field.
Returns:
The parameter-applied query string

serialize(){String}

Formats the query string as required by the LiveView server.
Returns:
The parameter-applied, server-formatted query string