What is GQ?
Main goal
Among the rise of Rust as a fast and reliable programming language, countless projects have born to improve the performance and the overall experience of users and developers. Is in this context where GQ comes to life, a filtering tool that aims to provide the fastest processing times along with a significant improvement in the simplicity of its underlying query language.
Query language
Based on GraphQL, we wanted to extend the capabilities of an already powerful QL outside the realm of API development, remodeling it from the ground up to be more suitable for JSON filtering and accessing. let’s take a look at a simple example:
{ "id": 1, "customer": { "firstName": "Jhon", "lastName": "Doe" }, "products": [ { "id": 1, "name": "Product 1", "price": 100 }, { "id": 2, "name": "Product 2", "price": 200 } ]}{ customer.firstName products(price<=100): cheap}{ "first": "Jhon", "cheap": [ { "id": 1, "name": "Product 1", "price": 100 } ]}As you can see, the query language has some similarities with GraphQL, including a JSON-like syntax, the argument definition or the field aliasing. However, it adds more funtionalites like the dot operator to access nested fields or the extended comparison operators to filter array elements.
You can learn more about all the language capabilities in the Concepts Section.