Norm's select procs work with vanilla WHERE conditions, which you have to write manually. The problem is you have to know which table and column names correspond to which type and attribute names. This is error-prone, fragile in the long run, and all together ugly.
We need a query constructor that would allow the programmer to compose queries in terms of Nim types and object fields.
Instead of db.select(pets, """"Pet".species LIKE $1""", "dog"), I want something like db.select(pets, qry(Pet.species ~ "$1"), "dog") or db.select(pets, qry(Pet.species.like "$1"), "dog") or even db.select(pets, qry(Pet.species ~ "dog"))
Norm's
selectprocs work with vanillaWHEREconditions, which you have to write manually. The problem is you have to know which table and column names correspond to which type and attribute names. This is error-prone, fragile in the long run, and all together ugly.We need a query constructor that would allow the programmer to compose queries in terms of Nim types and object fields.
Instead of
db.select(pets, """"Pet".species LIKE $1""", "dog"), I want something likedb.select(pets, qry(Pet.species ~ "$1"), "dog")ordb.select(pets, qry(Pet.species.like "$1"), "dog")or evendb.select(pets, qry(Pet.species ~ "dog"))