persistent-template: Type-safe, non-relational, multi-backend persistence.

[ database, library, mit, yesod ] [ Propose Tags ]

Hackage documentation generation is not reliable. For up to date documentation, please see: http://www.stackage.org/package/persistent-template.


[Skip to Readme]
Versions [faq] 0.5.0, 0.5.0.1, 0.5.1, 0.6.1, 0.6.2, 0.6.3, 0.6.3.1, 0.7.0, 0.8.0, 0.8.1, 0.8.1.1, 0.8.1.2, 0.8.2, 0.9.0, 0.9.0.1, 0.9.0.2, 1.0.0, 1.0.0.1, 1.0.0.2, 1.1.0, 1.1.1, 1.1.2, 1.1.2.1, 1.1.2.2, 1.1.2.3, 1.1.2.4, 1.1.2.5, 1.1.3, 1.1.3.1, 1.2.0, 1.2.0.1, 1.2.0.2, 1.2.0.3, 1.2.0.4, 1.2.0.5, 1.2.0.6, 1.3.0, 1.3.1, 1.3.1.1, 1.3.1.2, 1.3.1.3, 1.3.1.4, 1.3.2.1, 1.3.2.2, 2.0.0, 2.0.0.1, 2.0.0.2, 2.0.0.3, 2.0.1, 2.0.1.1, 2.0.2, 2.0.2.1, 2.0.2.2, 2.0.3, 2.0.3.1, 2.0.3.2, 2.0.4, 2.0.5, 2.0.7, 2.0.8, 2.1, 2.1.0.1, 2.1.1, 2.1.3, 2.1.3.1, 2.1.3.2, 2.1.3.3, 2.1.3.4, 2.1.3.5, 2.1.3.6, 2.1.3.7, 2.1.4, 2.1.5, 2.1.6, 2.1.7, 2.1.8, 2.1.8.1, 2.5, 2.5.1, 2.5.1.1, 2.5.1.2, 2.5.1.3, 2.5.1.4, 2.5.1.5, 2.5.1.6, 2.5.2, 2.5.3, 2.5.3.1, 2.5.4, 2.6.0, 2.7.0, 2.7.1, 2.7.2, 2.7.3, 2.7.4, 2.8.0, 2.8.0.1, 2.8.1, 2.8.2, 2.8.2.1, 2.8.2.2, 2.8.2.3 (info)
Change log ChangeLog.md
Dependencies aeson (>=1.0 && <1.5), base (>=4.10 && <5), bytestring (>=0.10), containers, http-api-data (>=0.3.7), monad-control (==1.0.*), monad-logger, path-pieces, persistent (>=2.10 && <3), template-haskell (>=2.11), text (>=1.2), th-lift-instances (>=0.1.14 && <0.2), transformers (==0.5.*), unordered-containers [details]
License MIT
Author Michael Snoyman <michael@snoyman.com>
Maintainer Michael Snoyman <michael@snoyman.com>, Greg Weber <greg@gregweber.info>
Category Database, Yesod
Home page http://www.yesodweb.com/book/persistent
Bug tracker https://github.com/yesodweb/persistent/issues
Source repo head: git clone git://github.com/yesodweb/persistent.git
Uploaded by parsonsmatt at Sat Feb 8 01:16:30 UTC 2020
Distributions Arch:2.7.3, Debian:2.5.4, Fedora:2.5.4, FreeBSD:2.1.3.4, LTSHaskell:2.5.4, NixOS:2.8.2.1, Stackage:2.6.0, openSUSE:2.7.2
Downloads 108348 total (3834 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2020-02-08 [all 1 reports]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for persistent-template-2.8.2.3

[back to package description]

persistent-template

Provides Template Haskell helpers for persistent. For more information, see the chapter in the Yesod book.

code organization

The TH.hs module contains code generators. persistent-template uses EntityDefs that it gets from the quasi-quoter. The quasi-quoter is in persistent Quasi.hs Similarly mant of the types come from the persistent library

Development tips

To get a better idea of what code you're generating, you can output the content of Template Haskell expressions to a file:

stack test persistent-template --ghc-options='-ddump-splices -ddump-to-file'

The output will be in the .stack-work directory. The exact path will depend on your specific setup, but if you search for files ending in .dump-splices you'll find the output (find .stack-work -type f -name '*.dump-splices')

If you make changes to the generated code, it is highly recommended to compare the output with your changes to output from master (even better if this diff is included in your PR!). Seemingly small changes can have dramatic changes on the generated code.

For example, embedding an EntityDef in a function that was called for every field of that Entity made the number of generated lines O(N^2) for that function—very bad!