(for what it's worth, I've also got this configuration:
λ❯ pgConnString . connectInfo $ config
"host=localhost port=26257 dbname=defaultdb user=euphrate connect_timeout=10 client_encoding=UTF8"
)
data User1 = User1 {name :: Text, password :: Text}
t1 :: Table User1
t1 = table "user" []
data User2 = User2 {name :: Text, password :: Text, age :: Int}
t2 :: Table User2
t2 = table "user" []
main = withPostgreSQL $ migrate t1 t2 (\user -> user `with` [#age := 0])
ID
type in my entity and that prevents me from deriving generic aeson instances for it (as there appears to be no aeson or generic instances for ID
).Generic
instances in selda
, and To/FromJSON
in selda-json
Hej @valderman
I'm trying to migrate to selda-0.5.0.0 but stack refuses to build selda-postgresql:
❯ stack build
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for selda-postgresql-0.1.8.0:
selda-0.5.0.0 from stack configuration does not match >=0.4 && <0.5
The dependency seems to be listed correctly in the cabal file in the repo (< 0.6):
https://github.com/valderman/selda/blob/master/selda-postgresql/selda-postgresql.cabal
But it's still 0.4 as seen on Hackage:
https://hackage.haskell.org/package/selda-postgresql
Thanks!
OuterCols
is there to handle gracefully sharing values between scopes where it's safe to do so
--- table =
--- id | name
--- 0 | Anton
--- 1 | anton
names = query $ do
user <- select table
restrict $ LOWER(user ! #name) `like` "%a%"
return $ user ! #name
-- names is ["Anton", "anton"]
LOWER
, it outputs only ["anton"]
, understandably. I could construct multiple search strings manually to permute all different letter cases, make predicates from each individual one, and then join those predicates with .||
, but that sounds quite laborious