[Haskell-cafe] persistent sqlite: getting record by ID

Alexey Shmalko rasen.dubi at gmail.com
Sat Sep 19 01:28:53 UTC 2015


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-Class.html#g:5
[3]: http://hackage.haskell.org/package/persistent-2.2/docs/src/Database-Persist-Sql-Orphan-PersistStore.html#getTableName

On Sat, Sep 19, 2015 at 1:05 AM, miro <miroslav.karpis at 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 at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe


More information about the Haskell-Cafe mailing list