postgresql 如何将值传递给`sqlQuery“...WHERE x IN?“在IHP?

xxhby3vn  于 2023-06-22  发布在  PostgreSQL
关注(0)|答案(1)|浏览(94)

我试过了

users :: [Users] <- sqlQuery "SELECT * FROM users u … WHERE u.id IN ?" (userIds :: [Id User])

(Only userIds)(In userIds),但没有成功。我在文档中找不到任何例子。

gmxoilav

gmxoilav1#

我猜它是在引擎盖下使用postgres-simple,https://hackage.haskell.org/package/postgresql-simple-0.6.5/docs/Database-PostgreSQL-Simple.html#g:6给出了答案:

users :: [Users] <- sqlQuery "SELECT * FROM users u … WHERE u.id IN ?" (Only (In userIds))

相关问题