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]

Modules

[Index] [Quick Jump]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

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 aeson (>=1.0 && <1.6), base (>=4.10 && <5), bytestring (>=0.10), containers, http-api-data (>=0.3.7), monad-control (>=1.0 && <1.1), monad-logger, path-pieces, persistent (>=2.11 && <2.12), template-haskell (>=2.11 && <2.17), text (>=1.2), th-lift-instances (>=0.1.14 && <0.2), transformers (>=0.5 && <0.6), unordered-containers [details]
License MIT
Author Michael Snoyman <michael@snoyman.com>
Maintainer Michael Snoyman <michael@snoyman.com>, Greg Weber <greg@gregweber.info>
Revised Revision 2 made by parsonsmatt at 2021-03-30T13:52:49Z
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 2020-11-04T18:48:43Z
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 155011 total (374 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2020-11-05 [all 1 reports]

Readme for persistent-template-2.9.1.0

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