Open bssstudio opened 6 years ago
Providing a table name as a String
can break the type safety of this library.
So you should not do that.
I have multiple tables with schema that is exactly the same.
I guess you should make use of HasProjection
type class.
Given tables with columns foo :: String
and bar :: Int
, you can write the query like this.
(Updated due to a type error)
nRel
:: (HasProjection "foo" a String, HasProjection "bar" a Int)
=> Relation () a -> Relation () a
nRel tbl = relation $ do
t <- query tbl
wheres $ t ! #bar .=. value "some bar value"
...
(You may have to enable DataKinds
, OverloadedLabels
, and the other related extensions).
Hi! In my use case, I have multiple tables with schema that is exactly the same. What I would like to do is to provide the table name at runtime. I would use one table to generate the definitions with template haskell, but when building a relation, I would provide a different name.
Is this currently possible, or might this be a feature request?