persistent sqlite: getting record by ID
Please, can you help me with following? I’m trying to get a record from sqlite by id. I have found following peace of code,…but I’m missing the place that where can I specify the table I’m actually querying (like PersonId). get $ Key $ (PersistInt64 $ fromIntegral id) Cheers, Miro
I'm not a persistent user, but as far as I know persistent uses typeclasses to select appropriate table. According to the yesod book[1], it seems to be PersistEntity[2] class, precisely it's entityDef method (see source of getTableName[3] function). Hope this helps, Alexey [1]: http://www.yesodweb.com/book/persistent [2]: http://hackage.haskell.org/package/persistent-2.2/docs/Database-Persist-Clas... [3]: http://hackage.haskell.org/package/persistent-2.2/docs/src/Database-Persist-... On Sat, Sep 19, 2015 at 1:05 AM, miro <miroslav.karpis@gmail.com> wrote:
Please, can you help me with following?
I’m trying to get a record from sqlite by id. I have found following peace of code,…but I’m missing the place that where can I specify the table I’m actually querying (like PersonId).
get $ Key $ (PersistInt64 $ fromIntegral id)
Cheers, Miro
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
participants (2)
-
Alexey Shmalko -
miro