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

[ database, library, mit, yesod ] [ Propose Tags ] [ Report a vulnerability ]

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


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 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, 2.8.3.0, 2.8.3.1, 2.9, 2.9.1.0, 2.12.0.0 (info)
Change log ChangeLog.md
Dependencies base (>=4.10 && <5) [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 2021-03-30T13:46:52Z
Distributions Debian:2.8.2.3, FreeBSD:2.1.3.4, LTSHaskell:2.12.0.0, NixOS:2.12.0.0, Stackage:2.12.0.0
Reverse Dependencies 48 direct, 107 indirect [details]
Downloads 155440 total (555 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2021-03-30 [all 3 reports]

Readme for persistent-template-2.12.0.0

[back to package description]

Begone!

This package was absorbed into persistent with the 2.12.0.1 release.

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 many 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!