3 ms·
Inspired by the query language of EdgeDB and GraphQL, I created a npm package that can generate sql query from a more concise syntax. Some key features: * sel
by aabbcc1241 4y ago
Inspired by the query language of EdgeDB and GraphQL, I created a npm package that can generate sql query from a more concise syntax.
Some key features:
* select with nested syntax and auto generate join-table statements
* auto add table name to each column
It comes with a "typescript-playground-style" online demo so you can try it without any setup ;)
- verdverm 4y agoWhy is this better? Is conciseness always preferred? Is it better or preferable to have a shared syntax that works across languages and tools? Most importantly, what are the consequences of creating a custom language that only works in a narrow situation?
- aabbcc1241 4y agoThis tool output plain SQL, so it can work with the rest of tools built around the ordinary SQL.
- verdverm 4y agoIf I use Go, how is this going to work? The main point is that developers don't want to learn a bespoke language tied to a single tool. SQL relates to the underlying math and is known by many many people, even non-developers.
- aabbcc1241 4y agoThere could be equivalent converter in go, or you can copy the generated sql from the playground to go source code. This this tool becomes dev-time only. One of the design goal for this language is to enable developers that are not familiar with sql to get into work that involves database with less effort. This tool is like syntax sugar on the select part, the where, order by, groups by, having are the same as standard sql (except they can be distributed with corresponding table select, and they can appear in any order, which should be easier to dev with)
- aabbcc1241 4y agoThis language is inspired from query language used in EdgeDB, which is a standalone database program. Instead this language is converted into plain SQL, so it can work with any existing SQL databases, including mysql, postgres, mssql, sqlite, e.t.c. The handy part of this language is it allows selecting columns from multiple tables using nested syntax without writing join table statements explicitly.