Can't help myself:
const data: SqlQuery = sqls:
SELECT Pet.name
FROM Pet
INNER JOIN House
ON House.id = Pet.houseId
WHERE House.country = "CA"
Run
That would be really clean.
To followup on @Variount 's question. Is the ORM goal to be something like:
type
Pet = object {. tableName: "pets" .}
name: string
age: int {. fieldName: "age_years" .}
const data: SqlQuery = sqls:
select Pet.*
`from` Pet
where Peg.age
As to case, in this particular application, one could have a version that
supports the typical styling guidelines for SQL statements.
SELECT blah FROM xyz WHERE zin=4
Run
could be DSL'd as:
const data: SqlQuery = sqls:
SELECT "blah"
FROM
Ok, but the general idea is the same, of using an underscore to differentiate
code from the typical meaning. To me it's easier to read than those quotes the
DSL currently uses.
Python code usually uses a _leading_ underscore to mark an identifier "private"
and _trailing_ underscores to distinguish identifiers from keywords.
[https://www.python.org/dev/peps/pep-0008/#descriptive-naming-styles](https://www.python.org/dev/peps/pep-0008/#descriptive-naming-styles)
While this is a neat use of templates to create an SQL DSL, where does the ORM
part come in? I don't see any place to automatically load values into an
object/ref, aside from the procedures returning sequences.
What does a multi-line where clause look like? I couldn't find an example,
especially of a complex where clause, possibly using exists as one of the lines.
It's a pity the from keyword needs to be in single quotation marks. I was
trying to think of an alternative (e.g. source), but then it
I envy your productivity and inventiveness.
[https://juancarlospaco.github.io/nim-gatabase](https://juancarlospaco.github.io/nim-gatabase)
* `0` Dependency, uses `system.nim` only, everything is done via `template`
and `macro`, Docs, Examples, CI, etc etc (`db_postgres` for Postgres but
Optional)
* Running compile-time and