You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
i would like to add the minimal usage example of the Yesod-Book in https://www.yesodweb.com/book/persistent#persistent_synopsis to the README so that it appears on the main Github project landing page and Hackage package landing page, because i really like this style from the Rust community; You can quickly copy-paste a working example and get a feel for the operators. See Serde, Rocket, Askama etc. Would that be desired?
Maybe make the example even shorter? E.g.
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
importControl.Monad.IO.Class (liftIO)
importDatabase.PersistimportDatabase.Persist.SqliteimportDatabase.Persist.THimportData.Text
share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase|
Person
name Text
age Int Maybe
deriving Show
|]
main::IO()
main = runSqlite ":memory:"$do-- setup db schema
runMigration migrateAll
-- write to db
insert $Person"Jane Doe"Nothing
johnId <- insert $Person"John Doe"$Just35-- read from db
john1 <- selectList [PersonId==. johnId] [LimitTo1]
john2 <- get johnId
liftIO $print (john1 :: [EntityPerson])
liftIO $print (john2 ::MaybePerson)
-- delete from db
delete johnId
deleteWhere [PersonId==. johnId]
The text was updated successfully, but these errors were encountered:
I added a PR. Ideally, the README with an example would also appear in Hackage: https://hackage.haskell.org/package/persistent. Please let me know how if that's desired as well and i could do that.
I would like to add similar minimal examples into the README of persistent-postgresql (and possible the others)
Hi,
i would like to add the minimal usage example of the Yesod-Book in https://www.yesodweb.com/book/persistent#persistent_synopsis to the README so that it appears on the main Github project landing page and Hackage package landing page, because i really like this style from the Rust community; You can quickly copy-paste a working example and get a feel for the operators. See Serde, Rocket, Askama etc. Would that be desired?
Maybe make the example even shorter? E.g.
The text was updated successfully, but these errors were encountered: