Hoogle Search

Within LTS Haskell 22.13 (ghc-9.6.4)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. mkPersist :: MkPersistSettings -> [UnboundEntityDef] -> Q [Dec]

    persistent Database.Persist.TH

    Create data types and appropriate PersistEntity instances for the given UnboundEntityDefs. This function should be used if you are only defining a single block of Persistent models for the entire application. If you intend on defining multiple blocks in different fiels, see mkPersistWith which allows you to provide existing entity definitions so foreign key references work. Example:

    mkPersist sqlSettings [persistLowerCase|
    User
    name    Text
    age     Int
    
    Dog
    name    Text
    owner   UserId
    
    |]
    
    Example from a file:
    mkPersist sqlSettings $(persistFileWith lowerCaseSettings "models.persistentmodels")
    
    For full information on the QuasiQuoter syntax, see Database.Persist.Quasi documentation.

Page 1 of 1