In my application I need to be able to write a query that takes a list of IDs and returns a list of each of those records.
From what I can tell from the yesod persistent page I could do something like
selectList (UserId ==. 1 ||. UserId ==. 2 ||. UserId ==. 3) []
Which I believe would return a list containing user 1, 2 and 3 but I can't work out how I would write this query when I don't know the list or how long it will be at compile time.
How would I go about selecting a list of records using a list of IDs in Haskell persistent.
Persistent has several combinators for creating queries the one you are looking for is
(<-.) :: PersistField typ => EntityField v typ -> [typ] -> Filter v
.Then your query can be simplified to