Getting Started
MistQL is a miniature language for performing computations on JSON-like structures.
MistQL's JavaScript implementation is built from the ground up to be included in clientside browser applications. It has no dependencies and has a total footprint of 5.3kB gzipped, making it suitable for size-sensitive frontends.
#
InstallationThe JavaScript implementation of MistQL is installed via the following:
npm install --save mistql
The Python implementation of MistQL is installed via the following:
pip install mistql
#
Code usageMistQL's primary interface is through programatic access:
// JavaScriptimport mistql from 'mistql';
const query = 'events | filter type == "purchase" | groupby email | keys';const purchaserEmails = mistql.query(query, data);
# Pythonimport mistql
query = 'events | filter type == "purchase" | groupby email | keys'purchaserEmails = mistql.query(query, data)
#
Command line usageMistQL exposes a command line interface under the name mq
. mq
can be installed globally via npm install -g mistql
.
The CLI can be used via mq <query> [file]
If file is not provided, mq
defaults to stdin
. An example usage might be the following:
$ echo "[]" | mq "count @"> 0