valderman / selda

A type-safe, high-level SQL library for Haskell
https://selda.link
MIT License
478 stars 58 forks source link

get TableName from Table #147

Closed cdepillabout closed 3 years ago

cdepillabout commented 4 years ago

There doesn't appear to be any way to get a TableName from a Table (unless I'm just missing the function that does this).

My suggestion would be to add a TableName field to TableInfo, so that you can get a Table's TableName with the tableInfo function.


My reason for wanting this is as follows.

I am trying to construct a raw query string that I can pass to rawQuery.

I want to generate the table name from the Table definition. This is so that if I ever change the table name, I only have to change it in one place (the Table definition), instead of two places, the Table definition and the raw query string.

valderman commented 4 years ago

How about we add a tableName field to the TableInfo type? It sounds like the natural place for this.