nikita-volkov / hasql-th

Template Haskell utilities for Hasql
http://hackage.haskell.org/package/hasql-th
MIT License
114 stars 8 forks source link

Possibility to splice table names? #13

Closed Javran closed 4 years ago

Javran commented 4 years ago

Well, sorry I clicked post button way too early....

so basically I'm wondering if the following is possible:

queryStatement :: Text -> Statement (Vector Int64) (Vector Int64)
queryStatement tableName =
    [vectorStatement|SELECT foo :: int8 FROM ${encodeUtf8 tableName}|]

for now it complains about:

 unexpected "${tableName}"
 expecting table reference or white space

the error sounds like I've got the unquote syntax wrong though...

nikita-volkov commented 4 years ago

This is not supported and likely never will be since it's not the purpose of this library.