Hi, this project that meant to be used in my side projects, the soul purpose of it
- Remove the need to create simple API endpoints.
- Handle custom query from the frontend without having the API to change.
- Meant as replacement of GraphQL.
- I always wanted to build Tree Walker interpreter.
The project will do the following tasks mainly:
- Validate the client query doesn't abuse the server.
- Ensure the query is valid "at Compile time" - regulary pulling database info to validate against - (useful as CI task)
Example
SELECT name, price FROM Products
Where price > 25;
This query is synaticaly valid, however, this can pull huge amount of rows, therefore the server would refuse any query that doesn't limit the count of returned data.
- HTTP
- CACHE
- Pagination (Maybe)
const oDataVisitor = new ODataVisitor();
const sql = `SELECT * FROM Sales WHERE strftime('%m', ShipDate) = '12';`;
const tokenizer = new Tokenizer(sql);
const tokens = tokenizer.tokenize();
const parser = new Parser(tokens);
const ast = parser.parse();
console.log(oDataVisitor.execute(ast));
// /Sales?$filter=month(ShipDate) eq '12'