haskell - Yesod accessing a persistent entity id from hamlet -


i have persistent pulling list of products database , displaying them on screen. use id database store information these products in cookie , link more detailed information pages. understand id present in persistent entity , not in actual product type? mean should store additional field random string can use in cookie or there way access id used in database? adding cookies using javascript.

up until have used php , use id. i'm not sure if same in yesod because of type safety or if there best practice way this.

if want id of record entity inside handler like:

(entity key _) <- rundb $ getby ... 

a query not use id values(eg: get) return entity contains both id , values.

see: http://www.yesodweb.com/book/persistent#persistent_fetching_by_unique_constraint

you can see getby returns (entity personid person) wrapped in maybe works selectlist


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

http - Safari render HTML as received -