partiql-rs

An implementation of PartiQL written in Rust

Document(WIP)

```toml:tests-make/hello.toml [tests.hello] script = ''' cat< | target config file [possible values: csv, json, toml, yaml, xml] -t, --to | target config file [possible values: csv, json, toml, yaml, xml] use `-t` option c to convert Json, Yaml, Toml, and XML to each other. ```sh:$ cat pokemon.json | pq -t yaml ``` ```sh:$ cat pokemon.json | pq -t yaml | pq -t toml ``` Comparison with existing command yj[^yj] | format | pq | yj | | --- | --- | --- | | JSON | ✅ | ✅ | | TOML | ✅ | ⚠️*1 | | YAML | ✅ | ✅ | | XML | ✅ | ✅ | | CSV | ✅ | ❌ | *1 TOML of the following format cannot be serialized with `yj`, but it can be serialized with `pq` by replacing the fields accordingly. ```json:pakcge.json { "name": "partiql-pokemon", "dependencies": { "react": "^16.13.1", "react-dom": "^16.13.1" }, "license": "MIT" } ``` | option | description | | ---- | ---- | | `-q` | クエリ | | query | description | | --- | --- | | `SELECT ` | | `SELECT AS ` | ### Calculate BMI 1. Download the file and then calculate BMI in local. ```sh:$ curl -s https://raw.githubusercontent.com/fuyutarow/pokemon.json/master/en/pokemon.json | pq -q "SELECT name, weight/height/height AS bmi ORDER BY bmi DESC LIMIT 20" ``` 2. In terminal, send a query to the server to calculate BMI in remote. ```sh:$ curl https://partiql-pokemon.vercel.app/api/pokemon/ja -G --data-urlencode "q= SELECT name, weight/height/height AS bmi ORDER BY bmi DESC LIMIT 20" ``` 3. In web browser, send a query to the server to calculate BMI in remote. ["https://partiql-pokemon.vercel.app/api/pokemon/en?q= SELECT name, weight/height/height AS bmi ORDER BY bmi DESC LIMIT 20"] (https://partiql-pokemon.vercel.app/api/pokemon/ja?q=%20SELECT%20name,%20weight/height/height%20AS%20%20bmi%20ORDER%20BY%20bmi%20DESC%20LIMIT%2020) partiql-pokemon.vercel.app/api/pokemon/en?q= SELECT name, weight/height/height AS bmi ORDER BY bmi DESC LIMIT 20 [partiql-pokemon.vercel.app/api/pokemon/en?q= SELECT name, weight/height/height AS bmi ORDER BY bmi DESC LIMIT 20] (https://partiql-pokemon.vercel.app/api/pokemon/ja?q=%20SELECT%20name,%20weight/height/height%20AS%20%20bmi%20ORDER%20BY%20bmi%20DESC%20LIMIT%2020) https://partiql-pokemon.vercel.app/api/pokemon/ja?q=%20SELECT%20name,%20weight/height/height%20AS%20%20bmi%20ORDER%20BY%20bmi%20DESC%20LIMIT%2020 ## Installation ```sh:$ brew install fuyutarow/tap/pq pq -h ``` ```sh:$ scoop install pq pq -h ``` ### Convert data ``` env | jo | pq "SELECT NAME AS name, USER AS user" ``` `ip` command is only available in Linux and WSL, not in Mac. ``` ip -j -p | pq "$(cat<