This video is available to students only
Formatting the query
Preparing for the server setup by processing the output of the query builder into database-ready SQL
In this lesson we'll focus on the
formatQuery function exported by
formatQuery is useful for displaying different representations of the query, namely the internal JSON format (
"json"), the internal format with rule identifiers stripped out (
"json_without_ids"), SQL format (
WHERE clause only), and a parameterized format useful for interacting with APIs.
Besides the format of the query representation,
formatQuery has a couple of other options that can be set.
valueProcessor is a function that will process rule values, and
quoteFieldNamesWith will quote field names with the provided quote character in SQL mode.