You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the colNameFor function is slightly safer than just writing something like the following:
listFoos' :: Query s (Row s Foo)
listFoos' = do
let q =
"SELECT DISTINCT ON ( name, a, b ) * " <>
" FROM foos " <>
"ORDER BY name, a, b"
allColNames =
fmap colName $ tableColumnInfos $ tableInfo foosTable
rawQuery allColNames q
colNameFor makes this listFoos slightly more robust in the case where columns have been renamed. When columns are renamed in the database, listFoos should fail to compile (because there will no longer be a matching IsLabel instance for the Table type), while listFoos' will continue to compile.
The text was updated successfully, but these errors were encountered:
I'd like to be able to get the underlying indices contained in a
Selector
.It seems like the easiest thing to do here would be to expose the
selectorIndex
getter, possibly inDatabase.Selda.Unsafe
.My use-case for this is that I'd like to be able to programmatically generate the column name for a given selector and table.
I'd like to write a function like the following:
I'd like to be able to have some minimal amount of schema checking when writing raw SQL.
For instance, I want to use a
SELECT DISTINCT ON
statement (which it appears Selda doesn't have support for).I want to write a function like the following:
Using the
colNameFor
function is slightly safer than just writing something like the following:colNameFor
makes thislistFoos
slightly more robust in the case where columns have been renamed. When columns are renamed in the database,listFoos
should fail to compile (because there will no longer be a matchingIsLabel
instance for theTable
type), whilelistFoos'
will continue to compile.The text was updated successfully, but these errors were encountered: