Hoogle Search
Within LTS Haskell 24.3 (ghc-9.10.2)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
mkPersistWith :: MkPersistSettings -> [EntityDef] -> [UnboundEntityDef] -> Q [Dec]persistent Database.Persist.TH.Internal Like mkPersist, but allows you to provide a [EntityDef] representing the predefined entities. This function will include those EntityDef when looking for foreign key references. You should use this if you intend on defining Persistent models in multiple files. Suppose we define a table Foo which has no dependencies.
module DB.Foo where mkPersistWith sqlSettings [] [persistLowerCase| Foo name Text |]
Then, we define a table Bar which depends on Foo:module DB.Bar where import DB.Foo mkPersistWith sqlSettings [entityDef (Proxy :: Proxy Foo)] [persistLowerCase| Bar fooId FooId |]
Writing out the list of EntityDef can be annoying. The $(discoverEntities) shortcut will work to reduce this boilerplate.module DB.Quux where import DB.Foo import DB.Bar mkPersistWith sqlSettings $(discoverEntities) [persistLowerCase| Quux name Text fooId FooId barId BarId |]
mkPersistSettings :: Type -> MkPersistSettingshledger-web Hledger.Web.Import Create an MkPersistSettings with default values.
mkPersistWith :: MkPersistSettings -> [EntityDef] -> [UnboundEntityDef] -> Q [Dec]hledger-web Hledger.Web.Import Like mkPersist, but allows you to provide a [EntityDef] representing the predefined entities. This function will include those EntityDef when looking for foreign key references. You should use this if you intend on defining Persistent models in multiple files. Suppose we define a table Foo which has no dependencies.
module DB.Foo where mkPersistWith sqlSettings [] [persistLowerCase| Foo name Text |]
Then, we define a table Bar which depends on Foo:module DB.Bar where import DB.Foo mkPersistWith sqlSettings [entityDef (Proxy :: Proxy Foo)] [persistLowerCase| Bar fooId FooId |]
Writing out the list of EntityDef can be annoying. The $(discoverEntities) shortcut will work to reduce this boilerplate.module DB.Quux where import DB.Foo import DB.Bar mkPersistWith sqlSettings $(discoverEntities) [persistLowerCase| Quux name Text fooId FooId barId BarId |]
mkPersistSettings :: Type -> MkPersistSettingsclassy-prelude-yesod ClassyPrelude.Yesod Create an MkPersistSettings with default values.
mkPersistWith :: MkPersistSettings -> [EntityDef] -> [UnboundEntityDef] -> Q [Dec]classy-prelude-yesod ClassyPrelude.Yesod Like mkPersist, but allows you to provide a [EntityDef] representing the predefined entities. This function will include those EntityDef when looking for foreign key references. You should use this if you intend on defining Persistent models in multiple files. Suppose we define a table Foo which has no dependencies.
module DB.Foo where mkPersistWith sqlSettings [] [persistLowerCase| Foo name Text |]
Then, we define a table Bar which depends on Foo:module DB.Bar where import DB.Foo mkPersistWith sqlSettings [entityDef (Proxy :: Proxy Foo)] [persistLowerCase| Bar fooId FooId |]
Writing out the list of EntityDef can be annoying. The $(discoverEntities) shortcut will work to reduce this boilerplate.module DB.Quux where import DB.Foo import DB.Bar mkPersistWith sqlSettings $(discoverEntities) [persistLowerCase| Quux name Text fooId FooId barId BarId |]
-
persistent Database.Persist.TH Settings that can be passed to the mkPersist (mps) function to control what code is generated. This is (just) the data type definition, so you will most likely want to use and adapt concrete values like sqlSettings.
-
persistent Database.Persist.TH.Internal Settings that can be passed to the mkPersist (mps) function to control what code is generated. This is (just) the data type definition, so you will most likely want to use and adapt concrete values like sqlSettings.
-
persistent-test Init Settings that can be passed to the mkPersist (mps) function to control what code is generated. This is (just) the data type definition, so you will most likely want to use and adapt concrete values like sqlSettings.
-
hledger-web Hledger.Web.Import Settings that can be passed to the mkPersist (mps) function to control what code is generated. This is (just) the data type definition, so you will most likely want to use and adapt concrete values like sqlSettings.
-
classy-prelude-yesod ClassyPrelude.Yesod Settings that can be passed to the mkPersist (mps) function to control what code is generated. This is (just) the data type definition, so you will most likely want to use and adapt concrete values like sqlSettings.