/usr/share/doc/libghc-persistent-doc/html/Database-Persist-Class.html is in libghc-persistent-doc 2.2.4-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Database.Persist.Class</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Database-Persist-Class.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Database-Persist-Class.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">persistent-2.2.4: Type-safe, multi-backend data serialization.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Database.Persist.Class</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">PersistStore</a></li><li><a href="#g:2">PersistUnique</a></li><li><a href="#g:3">PersistQuery</a></li><li><a href="#g:4">DeleteCascade</a></li><li><a href="#g:5">PersistEntity</a></li><li><a href="#g:6">PersistField</a></li><li><a href="#g:7">PersistConfig</a></li><li><a href="#g:8">Lifting</a></li><li><a href="#g:9">JSON utilities</a></li></ul></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">class</span> (<a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> record, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> record ~ backend, <a href="Database-Persist-Class.html#t:PersistStore">PersistStore</a> backend) => <a href="#t:ToBackendKey">ToBackendKey</a> backend record <span class="keyword">where</span><ul class="subs"><li><a href="#v:toBackendKey">toBackendKey</a> :: <a href="Database-Persist-Class.html#t:Key">Key</a> record -> <a href="Database-Persist-Class.html#t:BackendKey">BackendKey</a> backend</li><li><a href="#v:fromBackendKey">fromBackendKey</a> :: <a href="Database-Persist-Class.html#t:BackendKey">BackendKey</a> backend -> <a href="Database-Persist-Class.html#t:Key">Key</a> record</li></ul></li><li class="src short"><span class="keyword">class</span> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a> (<a href="Database-Persist-Class.html#t:BackendKey">BackendKey</a> backend), <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Read.html#t:Read">Read</a> (<a href="Database-Persist-Class.html#t:BackendKey">BackendKey</a> backend), <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> (<a href="Database-Persist-Class.html#t:BackendKey">BackendKey</a> backend), <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Ord.html#t:Ord">Ord</a> (<a href="Database-Persist-Class.html#t:BackendKey">BackendKey</a> backend), <a href="Database-Persist-Class.html#t:PersistField">PersistField</a> (<a href="Database-Persist-Class.html#t:BackendKey">BackendKey</a> backend), <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:ToJSON">ToJSON</a> (<a href="Database-Persist-Class.html#t:BackendKey">BackendKey</a> backend), <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:FromJSON">FromJSON</a> (<a href="Database-Persist-Class.html#t:BackendKey">BackendKey</a> backend)) => <a href="#t:PersistStore">PersistStore</a> backend <span class="keyword">where</span><ul class="subs"><li><span class="keyword">data</span> <a href="#t:BackendKey">BackendKey</a> backend</li><li><a href="#v:get">get</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => <a href="Database-Persist-Class.html#t:Key">Key</a> val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> val)</li><li><a href="#v:insert">insert</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="Database-Persist-Class.html#t:Key">Key</a> val)</li><li><a href="#v:insert_">insert_</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m ()</li><li><a href="#v:insertMany">insertMany</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => [val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m [<a href="Database-Persist-Class.html#t:Key">Key</a> val]</li><li><a href="#v:insertMany_">insertMany_</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => [val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m ()</li><li><a href="#v:insertEntityMany">insertEntityMany</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => [<a href="Database-Persist-Types.html#t:Entity">Entity</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m ()</li><li><a href="#v:insertKey">insertKey</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => <a href="Database-Persist-Class.html#t:Key">Key</a> val -> val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m ()</li><li><a href="#v:repsert">repsert</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => <a href="Database-Persist-Class.html#t:Key">Key</a> val -> val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m ()</li><li><a href="#v:replace">replace</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => <a href="Database-Persist-Class.html#t:Key">Key</a> val -> val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m ()</li><li><a href="#v:delete">delete</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => <a href="Database-Persist-Class.html#t:Key">Key</a> val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m ()</li><li><a href="#v:update">update</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val) => <a href="Database-Persist-Class.html#t:Key">Key</a> val -> [<a href="Database-Persist-Types.html#t:Update">Update</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m ()</li><li><a href="#v:updateGet">updateGet</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val) => <a href="Database-Persist-Class.html#t:Key">Key</a> val -> [<a href="Database-Persist-Types.html#t:Update">Update</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m val</li></ul></li><li class="src short"><a href="#v:getJust">getJust</a> :: (<a href="Database-Persist-Class.html#t:PersistStore">PersistStore</a> backend, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> val), backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m) => <a href="Database-Persist-Class.html#t:Key">Key</a> val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m val</li><li class="src short"><a href="#v:belongsTo">belongsTo</a> :: (<a href="Database-Persist-Class.html#t:PersistStore">PersistStore</a> backend, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> ent1, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> ent2, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> ent2, <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m) => (ent1 -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> ent2)) -> ent1 -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> ent2)</li><li class="src short"><a href="#v:belongsToJust">belongsToJust</a> :: (<a href="Database-Persist-Class.html#t:PersistStore">PersistStore</a> backend, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> ent1, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> ent2, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> ent2, <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m) => (ent1 -> <a href="Database-Persist-Class.html#t:Key">Key</a> ent2) -> ent1 -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m ent2</li><li class="src short"><a href="#v:insertEntity">insertEntity</a> :: (<a href="Database-Persist-Class.html#t:PersistStore">PersistStore</a> backend, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> e, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> e, <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m) => e -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="Database-Persist-Types.html#t:Entity">Entity</a> e)</li><li class="src short"><span class="keyword">class</span> <a href="Database-Persist-Class.html#t:PersistStore">PersistStore</a> backend => <a href="#t:PersistUnique">PersistUnique</a> backend <span class="keyword">where</span><ul class="subs"><li><a href="#v:getBy">getBy</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => <a href="Database-Persist-Class.html#t:Unique">Unique</a> val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Database-Persist-Types.html#t:Entity">Entity</a> val))</li><li><a href="#v:deleteBy">deleteBy</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val ~ backend, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => <a href="Database-Persist-Class.html#t:Unique">Unique</a> val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m ()</li><li><a href="#v:insertUnique">insertUnique</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val ~ backend, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> val))</li><li><a href="#v:upsert">upsert</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val ~ backend, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => val -> [<a href="Database-Persist-Types.html#t:Update">Update</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="Database-Persist-Types.html#t:Entity">Entity</a> val)</li></ul></li><li class="src short"><a href="#v:getByValue">getByValue</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> record, <a href="Database-Persist-Class.html#t:PersistUnique">PersistUnique</a> backend, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> record ~ backend) => record -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Database-Persist-Types.html#t:Entity">Entity</a> record))</li><li class="src short"><a href="#v:insertBy">insertBy</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, <a href="Database-Persist-Class.html#t:PersistUnique">PersistUnique</a> backend, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val ~ backend) => val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> (<a href="Database-Persist-Types.html#t:Entity">Entity</a> val) (<a href="Database-Persist-Class.html#t:Key">Key</a> val))</li><li class="src short"><a href="#v:replaceUnique">replaceUnique</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> record, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> (<a href="Database-Persist-Class.html#t:Unique">Unique</a> record), <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> record ~ backend, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> record, <a href="Database-Persist-Class.html#t:PersistUnique">PersistUnique</a> backend) => <a href="Database-Persist-Class.html#t:Key">Key</a> record -> record -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Database-Persist-Class.html#t:Unique">Unique</a> record))</li><li class="src short"><a href="#v:checkUnique">checkUnique</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> record ~ backend, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> record, <a href="Database-Persist-Class.html#t:PersistUnique">PersistUnique</a> backend) => record -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Database-Persist-Class.html#t:Unique">Unique</a> record))</li><li class="src short"><a href="#v:onlyUnique">onlyUnique</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, <a href="Database-Persist-Class.html#t:PersistUnique">PersistUnique</a> backend, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val ~ backend) => val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="Database-Persist-Class.html#t:Unique">Unique</a> val)</li><li class="src short"><span class="keyword">class</span> <a href="Database-Persist-Class.html#t:PersistStore">PersistStore</a> backend => <a href="#t:PersistQuery">PersistQuery</a> backend <span class="keyword">where</span><ul class="subs"><li><a href="#v:updateWhere">updateWhere</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> val] -> [<a href="Database-Persist-Types.html#t:Update">Update</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m ()</li><li><a href="#v:deleteWhere">deleteWhere</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m ()</li><li><a href="#v:selectSourceRes">selectSourceRes</a> :: (<a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val ~ backend, <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m1, <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m2) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> val] -> [<a href="Database-Persist-Types.html#t:SelectOpt">SelectOpt</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m1 (<a href="file:///usr/share/doc/libghc-resourcet-doc/html/Data-Acquire.html#t:Acquire">Acquire</a> (<a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Source">Source</a> m2 (<a href="Database-Persist-Types.html#t:Entity">Entity</a> val)))</li><li><a href="#v:selectFirst">selectFirst</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> val] -> [<a href="Database-Persist-Types.html#t:SelectOpt">SelectOpt</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Database-Persist-Types.html#t:Entity">Entity</a> val))</li><li><a href="#v:selectKeysRes">selectKeysRes</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m1, <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m2, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> val] -> [<a href="Database-Persist-Types.html#t:SelectOpt">SelectOpt</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m1 (<a href="file:///usr/share/doc/libghc-resourcet-doc/html/Data-Acquire.html#t:Acquire">Acquire</a> (<a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Source">Source</a> m2 (<a href="Database-Persist-Class.html#t:Key">Key</a> val)))</li><li><a href="#v:count">count</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a></li></ul></li><li class="src short"><a href="#v:selectSource">selectSource</a> :: (<a href="Database-Persist-Class.html#t:PersistQuery">PersistQuery</a> backend, <a href="file:///usr/share/doc/libghc-resourcet-doc/html/Control-Monad-Trans-Resource.html#t:MonadResource">MonadResource</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val ~ backend, <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader-Class.html#t:MonadReader">MonadReader</a> env m, <a href="Database-Persist-Class.html#t:HasPersistBackend">HasPersistBackend</a> env backend) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> val] -> [<a href="Database-Persist-Types.html#t:SelectOpt">SelectOpt</a> val] -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Source">Source</a> m (<a href="Database-Persist-Types.html#t:Entity">Entity</a> val)</li><li class="src short"><a href="#v:selectKeys">selectKeys</a> :: (<a href="Database-Persist-Class.html#t:PersistQuery">PersistQuery</a> backend, <a href="file:///usr/share/doc/libghc-resourcet-doc/html/Control-Monad-Trans-Resource.html#t:MonadResource">MonadResource</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader-Class.html#t:MonadReader">MonadReader</a> env m, <a href="Database-Persist-Class.html#t:HasPersistBackend">HasPersistBackend</a> env backend) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> val] -> [<a href="Database-Persist-Types.html#t:SelectOpt">SelectOpt</a> val] -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Source">Source</a> m (<a href="Database-Persist-Class.html#t:Key">Key</a> val)</li><li class="src short"><a href="#v:selectList">selectList</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, <a href="Database-Persist-Class.html#t:PersistQuery">PersistQuery</a> backend, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val ~ backend) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> val] -> [<a href="Database-Persist-Types.html#t:SelectOpt">SelectOpt</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m [<a href="Database-Persist-Types.html#t:Entity">Entity</a> val]</li><li class="src short"><a href="#v:selectKeysList">selectKeysList</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, <a href="Database-Persist-Class.html#t:PersistQuery">PersistQuery</a> backend, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val ~ backend) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> val] -> [<a href="Database-Persist-Types.html#t:SelectOpt">SelectOpt</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m [<a href="Database-Persist-Class.html#t:Key">Key</a> val]</li><li class="src short"><span class="keyword">class</span> (<a href="Database-Persist-Class.html#t:PersistStore">PersistStore</a> backend, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> record, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> record) => <a href="#t:DeleteCascade">DeleteCascade</a> record backend <span class="keyword">where</span><ul class="subs"><li><a href="#v:deleteCascade">deleteCascade</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m => <a href="Database-Persist-Class.html#t:Key">Key</a> record -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m ()</li></ul></li><li class="src short"><a href="#v:deleteCascadeWhere">deleteCascadeWhere</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:DeleteCascade">DeleteCascade</a> record backend, <a href="Database-Persist-Class.html#t:PersistQuery">PersistQuery</a> backend) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> record] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m ()</li><li class="src short"><span class="keyword">class</span> (<a href="Database-Persist-Class.html#t:PersistField">PersistField</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record), <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:ToJSON">ToJSON</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record), <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:FromJSON">FromJSON</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record), <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record), <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Read.html#t:Read">Read</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record), <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record), <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Ord.html#t:Ord">Ord</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record)) => <a href="#t:PersistEntity">PersistEntity</a> record <span class="keyword">where</span><ul class="subs"><li><span class="keyword">type</span> <a href="#t:PersistEntityBackend">PersistEntityBackend</a> record</li><li><span class="keyword">data</span> <a href="#t:Key">Key</a> record</li><li><span class="keyword">data</span> <a href="#t:EntityField">EntityField</a> record :: * -> *</li><li><span class="keyword">data</span> <a href="#t:Unique">Unique</a> record</li><li><a href="#v:keyToValues">keyToValues</a> :: <a href="Database-Persist-Class.html#t:Key">Key</a> record -> [<a href="Database-Persist-Types.html#t:PersistValue">PersistValue</a>]</li><li><a href="#v:keyFromValues">keyFromValues</a> :: [<a href="Database-Persist-Types.html#t:PersistValue">PersistValue</a>] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record)</li><li><a href="#v:persistIdField">persistIdField</a> :: <a href="Database-Persist-Class.html#t:EntityField">EntityField</a> record (<a href="Database-Persist-Class.html#t:Key">Key</a> record)</li><li><a href="#v:entityDef">entityDef</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m => m record -> <a href="Database-Persist-Types.html#t:EntityDef">EntityDef</a></li><li><a href="#v:persistFieldDef">persistFieldDef</a> :: <a href="Database-Persist-Class.html#t:EntityField">EntityField</a> record typ -> <a href="Database-Persist-Types.html#t:FieldDef">FieldDef</a></li><li><a href="#v:toPersistFields">toPersistFields</a> :: record -> [<a href="Database-Persist-Types.html#t:SomePersistField">SomePersistField</a>]</li><li><a href="#v:fromPersistValues">fromPersistValues</a> :: [<a href="Database-Persist-Types.html#t:PersistValue">PersistValue</a>] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> record</li><li><a href="#v:persistUniqueKeys">persistUniqueKeys</a> :: record -> [<a href="Database-Persist-Class.html#t:Unique">Unique</a> record]</li><li><a href="#v:persistUniqueToFieldNames">persistUniqueToFieldNames</a> :: <a href="Database-Persist-Class.html#t:Unique">Unique</a> record -> [(<a href="Database-Persist-Types.html#t:HaskellName">HaskellName</a>, <a href="Database-Persist-Types.html#t:DBName">DBName</a>)]</li><li><a href="#v:persistUniqueToValues">persistUniqueToValues</a> :: <a href="Database-Persist-Class.html#t:Unique">Unique</a> record -> [<a href="Database-Persist-Types.html#t:PersistValue">PersistValue</a>]</li><li><a href="#v:fieldLens">fieldLens</a> :: <a href="Database-Persist-Class.html#t:EntityField">EntityField</a> record field -> <span class="keyword">forall</span> f. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> f => (field -> f field) -> <a href="Database-Persist-Types.html#t:Entity">Entity</a> record -> f (<a href="Database-Persist-Types.html#t:Entity">Entity</a> record)</li></ul></li><li class="src short"><span class="keyword">class</span> <a href="#t:PersistField">PersistField</a> a <span class="keyword">where</span><ul class="subs"><li><a href="#v:toPersistValue">toPersistValue</a> :: a -> <a href="Database-Persist-Types.html#t:PersistValue">PersistValue</a></li><li><a href="#v:fromPersistValue">fromPersistValue</a> :: <a href="Database-Persist-Types.html#t:PersistValue">PersistValue</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> a</li></ul></li><li class="src short"><span class="keyword">class</span> <a href="#t:PersistConfig">PersistConfig</a> c <span class="keyword">where</span><ul class="subs"><li><span class="keyword">type</span> <a href="#t:PersistConfigBackend">PersistConfigBackend</a> c :: (* -> *) -> * -> *</li><li><span class="keyword">type</span> <a href="#t:PersistConfigPool">PersistConfigPool</a> c</li><li><a href="#v:loadConfig">loadConfig</a> :: <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:Value">Value</a> -> <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:Parser">Parser</a> c</li><li><a href="#v:applyEnv">applyEnv</a> :: c -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> c</li><li><a href="#v:createPoolConfig">createPoolConfig</a> :: c -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> (<a href="Database-Persist-Class.html#t:PersistConfigPool">PersistConfigPool</a> c)</li><li><a href="#v:runPool">runPool</a> :: (<a href="file:///usr/share/doc/libghc-monad-control-doc/html/Control-Monad-Trans-Control.html#t:MonadBaseControl">MonadBaseControl</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m) => c -> <a href="Database-Persist-Class.html#t:PersistConfigBackend">PersistConfigBackend</a> c m a -> <a href="Database-Persist-Class.html#t:PersistConfigPool">PersistConfigPool</a> c -> m a</li></ul></li><li class="src short"><a href="#v:entityValues">entityValues</a> :: <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> record => <a href="Database-Persist-Types.html#t:Entity">Entity</a> record -> [<a href="Database-Persist-Types.html#t:PersistValue">PersistValue</a>]</li><li class="src short"><span class="keyword">class</span> <a href="#t:HasPersistBackend">HasPersistBackend</a> env backend | env -> backend <span class="keyword">where</span><ul class="subs"><li><a href="#v:persistBackend">persistBackend</a> :: env -> backend</li></ul></li><li class="src short"><a href="#v:liftPersist">liftPersist</a> :: (<a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader-Class.html#t:MonadReader">MonadReader</a> env m, <a href="Database-Persist-Class.html#t:HasPersistBackend">HasPersistBackend</a> env backend, <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m) => <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> a -> m a</li><li class="src short"><a href="#v:keyValueEntityToJSON">keyValueEntityToJSON</a> :: (<a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> record, <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:ToJSON">ToJSON</a> record, <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:ToJSON">ToJSON</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record)) => <a href="Database-Persist-Types.html#t:Entity">Entity</a> record -> <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:Value">Value</a></li><li class="src short"><a href="#v:keyValueEntityFromJSON">keyValueEntityFromJSON</a> :: (<a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> record, <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:FromJSON">FromJSON</a> record, <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:FromJSON">FromJSON</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record)) => <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:Value">Value</a> -> <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:Parser">Parser</a> (<a href="Database-Persist-Types.html#t:Entity">Entity</a> record)</li><li class="src short"><a href="#v:entityIdToJSON">entityIdToJSON</a> :: (<a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> record, <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:ToJSON">ToJSON</a> record, <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:ToJSON">ToJSON</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record)) => <a href="Database-Persist-Types.html#t:Entity">Entity</a> record -> <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:Value">Value</a></li><li class="src short"><a href="#v:entityIdFromJSON">entityIdFromJSON</a> :: (<a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> record, <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:FromJSON">FromJSON</a> record, <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:FromJSON">FromJSON</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record)) => <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:Value">Value</a> -> <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:Parser">Parser</a> (<a href="Database-Persist-Types.html#t:Entity">Entity</a> record)</li><li class="src short"><a href="#v:toPersistValueJSON">toPersistValueJSON</a> :: <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:ToJSON">ToJSON</a> a => a -> <a href="Database-Persist-Types.html#t:PersistValue">PersistValue</a></li><li class="src short"><a href="#v:fromPersistValueJSON">fromPersistValueJSON</a> :: <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:FromJSON">FromJSON</a> a => <a href="Database-Persist-Types.html#t:PersistValue">PersistValue</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> a</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">class</span> (<a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> record, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> record ~ backend, <a href="Database-Persist-Class.html#t:PersistStore">PersistStore</a> backend) => <a name="t:ToBackendKey" class="def">ToBackendKey</a> backend record <span class="keyword">where</span> <a href="src/Database-Persist-Class-PersistStore.html#ToBackendKey" class="link">Source</a></p><div class="doc"><p>ToBackendKey converts a <code><a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a></code> <code><a href="Database-Persist-Class.html#t:Key">Key</a></code> into a <code><a href="Database-Persist-Class.html#t:BackendKey">BackendKey</a></code>
This can be used by each backend to convert between a <code><a href="Database-Persist-Class.html#t:Key">Key</a></code> and a plain Haskell type.
For Sql, that is done with <code>toSqlKey</code> and <code>fromSqlKey</code>.</p><p>By default, a <code><a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a></code> uses the default <code><a href="Database-Persist-Class.html#t:BackendKey">BackendKey</a></code> for its Key
and is an instance of ToBackendKey</p><p>A <code><a href="Database-Persist-Class.html#t:Key">Key</a></code> that instead uses a custom type will not be an instance of <code><a href="Database-Persist-Class.html#t:ToBackendKey">ToBackendKey</a></code></p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:toBackendKey" class="def">toBackendKey</a> :: <a href="Database-Persist-Class.html#t:Key">Key</a> record -> <a href="Database-Persist-Class.html#t:BackendKey">BackendKey</a> backend <a href="src/Database-Persist-Class-PersistStore.html#toBackendKey" class="link">Source</a></p><p class="src"><a name="v:fromBackendKey" class="def">fromBackendKey</a> :: <a href="Database-Persist-Class.html#t:BackendKey">BackendKey</a> backend -> <a href="Database-Persist-Class.html#t:Key">Key</a> record <a href="src/Database-Persist-Class-PersistStore.html#fromBackendKey" class="link">Source</a></p></div></div><h1 id="g:1">PersistStore</h1><div class="top"><p class="src"><span class="keyword">class</span> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a> (<a href="Database-Persist-Class.html#t:BackendKey">BackendKey</a> backend), <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Read.html#t:Read">Read</a> (<a href="Database-Persist-Class.html#t:BackendKey">BackendKey</a> backend), <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> (<a href="Database-Persist-Class.html#t:BackendKey">BackendKey</a> backend), <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Ord.html#t:Ord">Ord</a> (<a href="Database-Persist-Class.html#t:BackendKey">BackendKey</a> backend), <a href="Database-Persist-Class.html#t:PersistField">PersistField</a> (<a href="Database-Persist-Class.html#t:BackendKey">BackendKey</a> backend), <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:ToJSON">ToJSON</a> (<a href="Database-Persist-Class.html#t:BackendKey">BackendKey</a> backend), <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:FromJSON">FromJSON</a> (<a href="Database-Persist-Class.html#t:BackendKey">BackendKey</a> backend)) => <a name="t:PersistStore" class="def">PersistStore</a> backend <span class="keyword">where</span> <a href="src/Database-Persist-Class-PersistStore.html#PersistStore" class="link">Source</a></p><div class="subs minimal"><p class="caption">Minimal complete definition</p><p class="src"><a href="Database-Persist-Class.html#v:get">get</a>, <a href="Database-Persist-Class.html#v:insert">insert</a>, <a href="Database-Persist-Class.html#v:insertKey">insertKey</a>, <a href="Database-Persist-Class.html#v:repsert">repsert</a>, <a href="Database-Persist-Class.html#v:replace">replace</a>, <a href="Database-Persist-Class.html#v:delete">delete</a>, <a href="Database-Persist-Class.html#v:update">update</a></p></div><div class="subs associated-types"><p class="caption">Associated Types</p><p class="src"><span class="keyword">data</span> <a name="t:BackendKey" class="def">BackendKey</a> backend <a href="src/Database-Persist-Class-PersistStore.html#BackendKey" class="link">Source</a></p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:get" class="def">get</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => <a href="Database-Persist-Class.html#t:Key">Key</a> val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> val) <a href="src/Database-Persist-Class-PersistStore.html#get" class="link">Source</a></p><div class="doc"><p>Get a record by identifier, if available.</p></div><p class="src"><a name="v:insert" class="def">insert</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="Database-Persist-Class.html#t:Key">Key</a> val) <a href="src/Database-Persist-Class-PersistStore.html#insert" class="link">Source</a></p><div class="doc"><p>Create a new record in the database, returning an automatically created
key (in SQL an auto-increment id).</p></div><p class="src"><a name="v:insert_" class="def">insert_</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m () <a href="src/Database-Persist-Class-PersistStore.html#insert_" class="link">Source</a></p><div class="doc"><p>Same as <code><a href="Database-Persist-Class.html#v:insert">insert</a></code>, but doesn't return a <code>Key</code>.</p></div><p class="src"><a name="v:insertMany" class="def">insertMany</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => [val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m [<a href="Database-Persist-Class.html#t:Key">Key</a> val] <a href="src/Database-Persist-Class-PersistStore.html#insertMany" class="link">Source</a></p><div class="doc"><p>Create multiple records in the database and return their <code><a href="Database-Persist-Class.html#t:Key">Key</a></code>s.</p><p>If you don't need the inserted <code><a href="Database-Persist-Class.html#t:Key">Key</a></code>s, use <code><a href="Database-Persist-Class.html#v:insertMany_">insertMany_</a></code>.</p><p>The MongoDB and PostgreSQL backends insert all records and
retrieve their keys in one database query.</p><p>The SQLite and MySQL backends use the slow, default implementation of
<code>mapM insert</code>.</p></div><p class="src"><a name="v:insertMany_" class="def">insertMany_</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => [val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m () <a href="src/Database-Persist-Class-PersistStore.html#insertMany_" class="link">Source</a></p><div class="doc"><p>Same as <code><a href="Database-Persist-Class.html#v:insertMany">insertMany</a></code>, but doesn't return any <code><a href="Database-Persist-Class.html#t:Key">Key</a></code>s.</p><p>The MongoDB, PostgreSQL, SQLite and MySQL backends insert all records in
one database query.</p></div><p class="src"><a name="v:insertEntityMany" class="def">insertEntityMany</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => [<a href="Database-Persist-Types.html#t:Entity">Entity</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m () <a href="src/Database-Persist-Class-PersistStore.html#insertEntityMany" class="link">Source</a></p><div class="doc"><p>Same as <code><a href="Database-Persist-Class.html#v:insertMany_">insertMany_</a></code>, but takes an <code><a href="Database-Persist-Types.html#t:Entity">Entity</a></code> instead of just a record.</p><p>Useful when migrating data from one entity to another
and want to preserve ids.</p><p>The MongoDB backend inserts all the entities in one database query.</p><p>The SQL backends use the slow, default implementation of
<code>mapM_ insertKey</code>.</p></div><p class="src"><a name="v:insertKey" class="def">insertKey</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => <a href="Database-Persist-Class.html#t:Key">Key</a> val -> val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m () <a href="src/Database-Persist-Class-PersistStore.html#insertKey" class="link">Source</a></p><div class="doc"><p>Create a new record in the database using the given key.</p></div><p class="src"><a name="v:repsert" class="def">repsert</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => <a href="Database-Persist-Class.html#t:Key">Key</a> val -> val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m () <a href="src/Database-Persist-Class-PersistStore.html#repsert" class="link">Source</a></p><div class="doc"><p>Put the record in the database with the given key.
Unlike <code><a href="Database-Persist-Class.html#v:replace">replace</a></code>, if a record with the given key does not
exist then a new record will be inserted.</p></div><p class="src"><a name="v:replace" class="def">replace</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => <a href="Database-Persist-Class.html#t:Key">Key</a> val -> val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m () <a href="src/Database-Persist-Class-PersistStore.html#replace" class="link">Source</a></p><div class="doc"><p>Replace the record in the database with the given
key. Note that the result is undefined if such record does
not exist, so you must use 'insertKey or <code><a href="Database-Persist-Class.html#v:repsert">repsert</a></code> in
these cases.</p></div><p class="src"><a name="v:delete" class="def">delete</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => <a href="Database-Persist-Class.html#t:Key">Key</a> val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m () <a href="src/Database-Persist-Class-PersistStore.html#delete" class="link">Source</a></p><div class="doc"><p>Delete a specific record by identifier. Does nothing if record does
not exist.</p></div><p class="src"><a name="v:update" class="def">update</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val) => <a href="Database-Persist-Class.html#t:Key">Key</a> val -> [<a href="Database-Persist-Types.html#t:Update">Update</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m () <a href="src/Database-Persist-Class-PersistStore.html#update" class="link">Source</a></p><div class="doc"><p>Update individual fields on a specific record.</p></div><p class="src"><a name="v:updateGet" class="def">updateGet</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val) => <a href="Database-Persist-Class.html#t:Key">Key</a> val -> [<a href="Database-Persist-Types.html#t:Update">Update</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m val <a href="src/Database-Persist-Class-PersistStore.html#updateGet" class="link">Source</a></p><div class="doc"><p>Update individual fields on a specific record, and retrieve the
updated value from the database.</p><p>Note that this function will throw an exception if the given key is not
found in the database.</p></div></div></div><div class="top"><p class="src"><a name="v:getJust" class="def">getJust</a> :: (<a href="Database-Persist-Class.html#t:PersistStore">PersistStore</a> backend, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> val), backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m) => <a href="Database-Persist-Class.html#t:Key">Key</a> val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m val <a href="src/Database-Persist-Class-PersistStore.html#getJust" class="link">Source</a></p><div class="doc"><p>Same as get, but for a non-null (not Maybe) foreign key
Unsafe unless your database is enforcing that the foreign key is valid</p></div></div><div class="top"><p class="src"><a name="v:belongsTo" class="def">belongsTo</a> :: (<a href="Database-Persist-Class.html#t:PersistStore">PersistStore</a> backend, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> ent1, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> ent2, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> ent2, <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m) => (ent1 -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> ent2)) -> ent1 -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> ent2) <a href="src/Database-Persist-Class-PersistStore.html#belongsTo" class="link">Source</a></p><div class="doc"><p>curry this to make a convenience function that loads an associated model</p><pre>foreign = belongsTo foerignId</pre></div></div><div class="top"><p class="src"><a name="v:belongsToJust" class="def">belongsToJust</a> :: (<a href="Database-Persist-Class.html#t:PersistStore">PersistStore</a> backend, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> ent1, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> ent2, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> ent2, <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m) => (ent1 -> <a href="Database-Persist-Class.html#t:Key">Key</a> ent2) -> ent1 -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m ent2 <a href="src/Database-Persist-Class-PersistStore.html#belongsToJust" class="link">Source</a></p><div class="doc"><p>same as belongsTo, but uses <code>getJust</code> and therefore is similarly unsafe</p></div></div><div class="top"><p class="src"><a name="v:insertEntity" class="def">insertEntity</a> :: (<a href="Database-Persist-Class.html#t:PersistStore">PersistStore</a> backend, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> e, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> e, <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m) => e -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="Database-Persist-Types.html#t:Entity">Entity</a> e) <a href="src/Database-Persist-Class-PersistStore.html#insertEntity" class="link">Source</a></p><div class="doc"><p>like <code>insert</code>, but returns the complete <code>Entity</code></p></div></div><h1 id="g:2">PersistUnique</h1><div class="top"><p class="src"><span class="keyword">class</span> <a href="Database-Persist-Class.html#t:PersistStore">PersistStore</a> backend => <a name="t:PersistUnique" class="def">PersistUnique</a> backend <span class="keyword">where</span> <a href="src/Database-Persist-Class-PersistUnique.html#PersistUnique" class="link">Source</a></p><div class="doc"><p>Queries against <code><a href="Database-Persist-Class.html#t:Unique">Unique</a></code> keys (other than the id <code><a href="Database-Persist-Class.html#t:Key">Key</a></code>).</p><p>Please read the general Persistent documentation to learn how to create
<code><a href="Database-Persist-Class.html#t:Unique">Unique</a></code> keys.</p><p>Using this with an Entity without a Unique key leads to undefined behavior.
A few of these functions require a *single* <code><a href="Database-Persist-Class.html#t:Unique">Unique</a></code>, so using an Entity with multiple <code><a href="Database-Persist-Class.html#t:Unique">Unique</a></code>s is also undefined. In these cases persistent's goal is to throw an exception as soon as possible, but persistent is still transitioning to that.</p><p>SQL backends automatically create uniqueness constraints, but for MongoDB you must manually place a unique index on a field to have a uniqueness constraint.</p><p>Some functions in this module (insertUnique, insertBy, and replaceUnique) first query the unique indexes to check for conflicts.
You could instead optimistically attempt to perform the operation (e.g. replace instead of replaceUnique). However,</p><ul><li>there is some fragility to trying to catch the correct exception and determing the column of failure.</li><li>an exception will automatically abort the current SQL transaction</li></ul></div><div class="subs minimal"><p class="caption">Minimal complete definition</p><p class="src"><a href="Database-Persist-Class.html#v:getBy">getBy</a>, <a href="Database-Persist-Class.html#v:deleteBy">deleteBy</a></p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:getBy" class="def">getBy</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => <a href="Database-Persist-Class.html#t:Unique">Unique</a> val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Database-Persist-Types.html#t:Entity">Entity</a> val)) <a href="src/Database-Persist-Class-PersistUnique.html#getBy" class="link">Source</a></p><div class="doc"><p>Get a record by unique key, if available. Returns also the identifier.</p></div><p class="src"><a name="v:deleteBy" class="def">deleteBy</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val ~ backend, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => <a href="Database-Persist-Class.html#t:Unique">Unique</a> val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m () <a href="src/Database-Persist-Class-PersistUnique.html#deleteBy" class="link">Source</a></p><div class="doc"><p>Delete a specific record by unique key. Does nothing if no record
matches.</p></div><p class="src"><a name="v:insertUnique" class="def">insertUnique</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val ~ backend, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val) => val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> val)) <a href="src/Database-Persist-Class-PersistUnique.html#insertUnique" class="link">Source</a></p><div class="doc"><p>Like <code><a href="Database-Persist-Class.html#v:insert">insert</a></code>, but returns <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#v:Nothing">Nothing</a></code> when the record
couldn't be inserted because of a uniqueness constraint.</p></div><p class="src"><a name="v:upsert" class="def">upsert</a> <a href="src/Database-Persist-Class-PersistUnique.html#upsert" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val ~ backend, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val)</td><td class="doc empty"> </td></tr><tr><td class="src">=> val</td><td class="doc"><p>new record to insert</p></td></tr><tr><td class="src">-> [<a href="Database-Persist-Types.html#t:Update">Update</a> val]</td><td class="doc"><p>updates to perform if the record already exists.
leaving this empty is the equivalent of performing a <code><a href="Database-Persist-Class.html#v:repsert">repsert</a></code> on a unique key.</p></td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="Database-Persist-Types.html#t:Entity">Entity</a> val)</td><td class="doc"><p>the record in the database after the operation</p></td></tr></table></div><div class="doc"><p>update based on a uniquness constraint or insert</p><p>insert the new record if it does not exist
update the existing record that matches the uniqueness contraint</p><p>Throws an exception if there is more than 1 uniqueness contraint</p></div></div></div><div class="top"><p class="src"><a name="v:getByValue" class="def">getByValue</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> record, <a href="Database-Persist-Class.html#t:PersistUnique">PersistUnique</a> backend, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> record ~ backend) => record -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Database-Persist-Types.html#t:Entity">Entity</a> record)) <a href="src/Database-Persist-Class-PersistUnique.html#getByValue" class="link">Source</a></p><div class="doc"><p>A modification of <code><a href="Database-Persist-Class.html#v:getBy">getBy</a></code>, which takes the <code><a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a></code> itself instead
of a <code><a href="Database-Persist-Class.html#t:Unique">Unique</a></code> record. Returns a record matching <em>one</em> of the unique keys. This
function makes the most sense on entities with a single <code><a href="Database-Persist-Class.html#t:Unique">Unique</a></code>
constructor.</p></div></div><div class="top"><p class="src"><a name="v:insertBy" class="def">insertBy</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, <a href="Database-Persist-Class.html#t:PersistUnique">PersistUnique</a> backend, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val ~ backend) => val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> (<a href="Database-Persist-Types.html#t:Entity">Entity</a> val) (<a href="Database-Persist-Class.html#t:Key">Key</a> val)) <a href="src/Database-Persist-Class-PersistUnique.html#insertBy" class="link">Source</a></p><div class="doc"><p>Insert a value, checking for conflicts with any unique constraints. If a
duplicate exists in the database, it is returned as <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#v:Left">Left</a></code>. Otherwise, the
new 'Key is returned as <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#v:Right">Right</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:replaceUnique" class="def">replaceUnique</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> record, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> (<a href="Database-Persist-Class.html#t:Unique">Unique</a> record), <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> record ~ backend, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> record, <a href="Database-Persist-Class.html#t:PersistUnique">PersistUnique</a> backend) => <a href="Database-Persist-Class.html#t:Key">Key</a> record -> record -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Database-Persist-Class.html#t:Unique">Unique</a> record)) <a href="src/Database-Persist-Class-PersistUnique.html#replaceUnique" class="link">Source</a></p><div class="doc"><p>Attempt to replace the record of the given key with the given new record.
First query the unique fields to make sure the replacement maintains uniqueness constraints.
Return <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#v:Nothing">Nothing</a></code> if the replacement was made.
If uniqueness is violated, return a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#v:Just">Just</a></code> with the <code><a href="Database-Persist-Class.html#t:Unique">Unique</a></code> violation</p><p>Since 1.2.2.0</p></div></div><div class="top"><p class="src"><a name="v:checkUnique" class="def">checkUnique</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> record ~ backend, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> record, <a href="Database-Persist-Class.html#t:PersistUnique">PersistUnique</a> backend) => record -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Database-Persist-Class.html#t:Unique">Unique</a> record)) <a href="src/Database-Persist-Class-PersistUnique.html#checkUnique" class="link">Source</a></p><div class="doc"><p>Check whether there are any conflicts for unique keys with this entity and
existing entities in the database.</p><p>Returns <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#v:Nothing">Nothing</a></code> if the entity would be unique, and could thus safely be inserted.
on a conflict returns the conflicting key</p></div></div><div class="top"><p class="src"><a name="v:onlyUnique" class="def">onlyUnique</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, <a href="Database-Persist-Class.html#t:PersistUnique">PersistUnique</a> backend, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val ~ backend) => val -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="Database-Persist-Class.html#t:Unique">Unique</a> val) <a href="src/Database-Persist-Class-PersistUnique.html#onlyUnique" class="link">Source</a></p><div class="doc"><p>Return the single unique key for a record</p></div></div><h1 id="g:3">PersistQuery</h1><div class="top"><p class="src"><span class="keyword">class</span> <a href="Database-Persist-Class.html#t:PersistStore">PersistStore</a> backend => <a name="t:PersistQuery" class="def">PersistQuery</a> backend <span class="keyword">where</span> <a href="src/Database-Persist-Class-PersistQuery.html#PersistQuery" class="link">Source</a></p><div class="subs minimal"><p class="caption">Minimal complete definition</p><p class="src"><a href="Database-Persist-Class.html#v:updateWhere">updateWhere</a>, <a href="Database-Persist-Class.html#v:deleteWhere">deleteWhere</a>, <a href="Database-Persist-Class.html#v:selectSourceRes">selectSourceRes</a>, <a href="Database-Persist-Class.html#v:selectKeysRes">selectKeysRes</a>, <a href="Database-Persist-Class.html#v:count">count</a></p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:updateWhere" class="def">updateWhere</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> val] -> [<a href="Database-Persist-Types.html#t:Update">Update</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m () <a href="src/Database-Persist-Class-PersistQuery.html#updateWhere" class="link">Source</a></p><div class="doc"><p>Update individual fields on any record matching the given criterion.</p></div><p class="src"><a name="v:deleteWhere" class="def">deleteWhere</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m () <a href="src/Database-Persist-Class-PersistQuery.html#deleteWhere" class="link">Source</a></p><div class="doc"><p>Delete all records matching the given criterion.</p></div><p class="src"><a name="v:selectSourceRes" class="def">selectSourceRes</a> :: (<a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val ~ backend, <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m1, <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m2) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> val] -> [<a href="Database-Persist-Types.html#t:SelectOpt">SelectOpt</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m1 (<a href="file:///usr/share/doc/libghc-resourcet-doc/html/Data-Acquire.html#t:Acquire">Acquire</a> (<a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Source">Source</a> m2 (<a href="Database-Persist-Types.html#t:Entity">Entity</a> val))) <a href="src/Database-Persist-Class-PersistQuery.html#selectSourceRes" class="link">Source</a></p><div class="doc"><p>Get all records matching the given criterion in the specified order.
Returns also the identifiers.</p></div><p class="src"><a name="v:selectFirst" class="def">selectFirst</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> val] -> [<a href="Database-Persist-Types.html#t:SelectOpt">SelectOpt</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Database-Persist-Types.html#t:Entity">Entity</a> val)) <a href="src/Database-Persist-Class-PersistQuery.html#selectFirst" class="link">Source</a></p><div class="doc"><p>get just the first record for the criterion</p></div><p class="src"><a name="v:selectKeysRes" class="def">selectKeysRes</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m1, <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m2, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> val] -> [<a href="Database-Persist-Types.html#t:SelectOpt">SelectOpt</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m1 (<a href="file:///usr/share/doc/libghc-resourcet-doc/html/Data-Acquire.html#t:Acquire">Acquire</a> (<a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Source">Source</a> m2 (<a href="Database-Persist-Class.html#t:Key">Key</a> val))) <a href="src/Database-Persist-Class-PersistQuery.html#selectKeysRes" class="link">Source</a></p><div class="doc"><p>Get the <code><a href="Database-Persist-Class.html#t:Key">Key</a></code>s of all records matching the given criterion.</p></div><p class="src"><a name="v:count" class="def">count</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> <a href="src/Database-Persist-Class-PersistQuery.html#count" class="link">Source</a></p><div class="doc"><p>The total number of records fulfilling the given criterion.</p></div></div></div><div class="top"><p class="src"><a name="v:selectSource" class="def">selectSource</a> :: (<a href="Database-Persist-Class.html#t:PersistQuery">PersistQuery</a> backend, <a href="file:///usr/share/doc/libghc-resourcet-doc/html/Control-Monad-Trans-Resource.html#t:MonadResource">MonadResource</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val ~ backend, <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader-Class.html#t:MonadReader">MonadReader</a> env m, <a href="Database-Persist-Class.html#t:HasPersistBackend">HasPersistBackend</a> env backend) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> val] -> [<a href="Database-Persist-Types.html#t:SelectOpt">SelectOpt</a> val] -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Source">Source</a> m (<a href="Database-Persist-Types.html#t:Entity">Entity</a> val) <a href="src/Database-Persist-Class-PersistQuery.html#selectSource" class="link">Source</a></p><div class="doc"><p>Get all records matching the given criterion in the specified order.
Returns also the identifiers.</p></div></div><div class="top"><p class="src"><a name="v:selectKeys" class="def">selectKeys</a> :: (<a href="Database-Persist-Class.html#t:PersistQuery">PersistQuery</a> backend, <a href="file:///usr/share/doc/libghc-resourcet-doc/html/Control-Monad-Trans-Resource.html#t:MonadResource">MonadResource</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val, <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader-Class.html#t:MonadReader">MonadReader</a> env m, <a href="Database-Persist-Class.html#t:HasPersistBackend">HasPersistBackend</a> env backend) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> val] -> [<a href="Database-Persist-Types.html#t:SelectOpt">SelectOpt</a> val] -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Source">Source</a> m (<a href="Database-Persist-Class.html#t:Key">Key</a> val) <a href="src/Database-Persist-Class-PersistQuery.html#selectKeys" class="link">Source</a></p><div class="doc"><p>Get the <code><a href="Database-Persist-Class.html#t:Key">Key</a></code>s of all records matching the given criterion.</p></div></div><div class="top"><p class="src"><a name="v:selectList" class="def">selectList</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, <a href="Database-Persist-Class.html#t:PersistQuery">PersistQuery</a> backend, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val ~ backend) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> val] -> [<a href="Database-Persist-Types.html#t:SelectOpt">SelectOpt</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m [<a href="Database-Persist-Types.html#t:Entity">Entity</a> val] <a href="src/Database-Persist-Class-PersistQuery.html#selectList" class="link">Source</a></p><div class="doc"><p>Call <code><a href="Database-Persist-Class.html#v:selectSource">selectSource</a></code> but return the result as a list.</p></div></div><div class="top"><p class="src"><a name="v:selectKeysList" class="def">selectKeysList</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> val, <a href="Database-Persist-Class.html#t:PersistQuery">PersistQuery</a> backend, <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> val ~ backend) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> val] -> [<a href="Database-Persist-Types.html#t:SelectOpt">SelectOpt</a> val] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m [<a href="Database-Persist-Class.html#t:Key">Key</a> val] <a href="src/Database-Persist-Class-PersistQuery.html#selectKeysList" class="link">Source</a></p><div class="doc"><p>Call <code><a href="Database-Persist-Class.html#v:selectKeys">selectKeys</a></code> but return the result as a list.</p></div></div><h1 id="g:4">DeleteCascade</h1><div class="top"><p class="src"><span class="keyword">class</span> (<a href="Database-Persist-Class.html#t:PersistStore">PersistStore</a> backend, <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> record, backend ~ <a href="Database-Persist-Class.html#t:PersistEntityBackend">PersistEntityBackend</a> record) => <a name="t:DeleteCascade" class="def">DeleteCascade</a> record backend <span class="keyword">where</span> <a href="src/Database-Persist-Class-DeleteCascade.html#DeleteCascade" class="link">Source</a></p><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:deleteCascade" class="def">deleteCascade</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m => <a href="Database-Persist-Class.html#t:Key">Key</a> record -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m () <a href="src/Database-Persist-Class-DeleteCascade.html#deleteCascade" class="link">Source</a></p></div></div><div class="top"><p class="src"><a name="v:deleteCascadeWhere" class="def">deleteCascadeWhere</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Database-Persist-Class.html#t:DeleteCascade">DeleteCascade</a> record backend, <a href="Database-Persist-Class.html#t:PersistQuery">PersistQuery</a> backend) => [<a href="Database-Persist-Types.html#t:Filter">Filter</a> record] -> <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend m () <a href="src/Database-Persist-Class-DeleteCascade.html#deleteCascadeWhere" class="link">Source</a></p></div><h1 id="g:5">PersistEntity</h1><div class="top"><p class="src"><span class="keyword">class</span> (<a href="Database-Persist-Class.html#t:PersistField">PersistField</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record), <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:ToJSON">ToJSON</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record), <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:FromJSON">FromJSON</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record), <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record), <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Read.html#t:Read">Read</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record), <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record), <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Ord.html#t:Ord">Ord</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record)) => <a name="t:PersistEntity" class="def">PersistEntity</a> record <span class="keyword">where</span> <a href="src/Database-Persist-Class-PersistEntity.html#PersistEntity" class="link">Source</a></p><div class="doc"><p>Persistent serialized Haskell records to the database.
A Database <code><a href="Database-Persist-Types.html#t:Entity">Entity</a></code> (A row in SQL, a document in MongoDB, etc)
corresponds to a <code><a href="Database-Persist-Class.html#t:Key">Key</a></code> plus a Haskell record.</p><p>For every Haskell record type stored in the database there is a corresponding <code><a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a></code> instance.
An instance of PersistEntity contains meta-data for the record.
PersistEntity also helps abstract over different record types.
That way the same query interface can return a <code><a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a></code>, with each query returning different types of Haskell records.</p><p>Some advanced type system capabilities are used to make this process type-safe.
Persistent users usually don't need to understand the class associated data and functions.</p></div><div class="subs associated-types"><p class="caption">Associated Types</p><p class="src"><span class="keyword">type</span> <a name="t:PersistEntityBackend" class="def">PersistEntityBackend</a> record <a href="src/Database-Persist-Class-PersistEntity.html#PersistEntityBackend" class="link">Source</a></p><div class="doc"><p>Persistent allows multiple different backends (databases)</p></div><p class="src"><span class="keyword">data</span> <a name="t:Key" class="def">Key</a> record <a href="src/Database-Persist-Class-PersistEntity.html#Key" class="link">Source</a></p><div class="doc"><p>By default, a backend will automatically generate the key
Instead you can specify a Primary key made up of unique values.</p></div><p class="src"><span class="keyword">data</span> <a name="t:EntityField" class="def">EntityField</a> record :: * -> * <a href="src/Database-Persist-Class-PersistEntity.html#EntityField" class="link">Source</a></p><div class="doc"><p>An <code><a href="Database-Persist-Class.html#t:EntityField">EntityField</a></code> is parameterised by the Haskell record it belongs to
and the additional type of that field</p></div><p class="src"><span class="keyword">data</span> <a name="t:Unique" class="def">Unique</a> record <a href="src/Database-Persist-Class-PersistEntity.html#Unique" class="link">Source</a></p><div class="doc"><p>Unique keys besides the Key</p></div></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:keyToValues" class="def">keyToValues</a> :: <a href="Database-Persist-Class.html#t:Key">Key</a> record -> [<a href="Database-Persist-Types.html#t:PersistValue">PersistValue</a>] <a href="src/Database-Persist-Class-PersistEntity.html#keyToValues" class="link">Source</a></p><div class="doc"><p>a lower-level key operation</p></div><p class="src"><a name="v:keyFromValues" class="def">keyFromValues</a> :: [<a href="Database-Persist-Types.html#t:PersistValue">PersistValue</a>] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record) <a href="src/Database-Persist-Class-PersistEntity.html#keyFromValues" class="link">Source</a></p><div class="doc"><p>a lower-level key operation</p></div><p class="src"><a name="v:persistIdField" class="def">persistIdField</a> :: <a href="Database-Persist-Class.html#t:EntityField">EntityField</a> record (<a href="Database-Persist-Class.html#t:Key">Key</a> record) <a href="src/Database-Persist-Class-PersistEntity.html#persistIdField" class="link">Source</a></p><div class="doc"><p>a meta-operation to retrieve the Key EntityField</p></div><p class="src"><a name="v:entityDef" class="def">entityDef</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m => m record -> <a href="Database-Persist-Types.html#t:EntityDef">EntityDef</a> <a href="src/Database-Persist-Class-PersistEntity.html#entityDef" class="link">Source</a></p><div class="doc"><p>retrieve the EntityDef meta-data for the record</p></div><p class="src"><a name="v:persistFieldDef" class="def">persistFieldDef</a> :: <a href="Database-Persist-Class.html#t:EntityField">EntityField</a> record typ -> <a href="Database-Persist-Types.html#t:FieldDef">FieldDef</a> <a href="src/Database-Persist-Class-PersistEntity.html#persistFieldDef" class="link">Source</a></p><div class="doc"><p>return meta-data for a given <code><a href="Database-Persist-Class.html#t:EntityField">EntityField</a></code></p></div><p class="src"><a name="v:toPersistFields" class="def">toPersistFields</a> :: record -> [<a href="Database-Persist-Types.html#t:SomePersistField">SomePersistField</a>] <a href="src/Database-Persist-Class-PersistEntity.html#toPersistFields" class="link">Source</a></p><div class="doc"><p>A meta-operation to get the database fields of a record</p></div><p class="src"><a name="v:fromPersistValues" class="def">fromPersistValues</a> :: [<a href="Database-Persist-Types.html#t:PersistValue">PersistValue</a>] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> record <a href="src/Database-Persist-Class-PersistEntity.html#fromPersistValues" class="link">Source</a></p><div class="doc"><p>A lower-level operation to convert from database values to a Haskell record</p></div><p class="src"><a name="v:persistUniqueKeys" class="def">persistUniqueKeys</a> :: record -> [<a href="Database-Persist-Class.html#t:Unique">Unique</a> record] <a href="src/Database-Persist-Class-PersistEntity.html#persistUniqueKeys" class="link">Source</a></p><div class="doc"><p>A meta operation to retrieve all the Unique keys</p></div><p class="src"><a name="v:persistUniqueToFieldNames" class="def">persistUniqueToFieldNames</a> :: <a href="Database-Persist-Class.html#t:Unique">Unique</a> record -> [(<a href="Database-Persist-Types.html#t:HaskellName">HaskellName</a>, <a href="Database-Persist-Types.html#t:DBName">DBName</a>)] <a href="src/Database-Persist-Class-PersistEntity.html#persistUniqueToFieldNames" class="link">Source</a></p><div class="doc"><p>A lower level operation</p></div><p class="src"><a name="v:persistUniqueToValues" class="def">persistUniqueToValues</a> :: <a href="Database-Persist-Class.html#t:Unique">Unique</a> record -> [<a href="Database-Persist-Types.html#t:PersistValue">PersistValue</a>] <a href="src/Database-Persist-Class-PersistEntity.html#persistUniqueToValues" class="link">Source</a></p><div class="doc"><p>A lower level operation</p></div><p class="src"><a name="v:fieldLens" class="def">fieldLens</a> :: <a href="Database-Persist-Class.html#t:EntityField">EntityField</a> record field -> <span class="keyword">forall</span> f. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> f => (field -> f field) -> <a href="Database-Persist-Types.html#t:Entity">Entity</a> record -> f (<a href="Database-Persist-Types.html#t:Entity">Entity</a> record) <a href="src/Database-Persist-Class-PersistEntity.html#fieldLens" class="link">Source</a></p><div class="doc"><p>Use a PersistField as a lens</p></div></div></div><h1 id="g:6">PersistField</h1><div class="top"><p class="src"><span class="keyword">class</span> <a name="t:PersistField" class="def">PersistField</a> a <span class="keyword">where</span> <a href="src/Database-Persist-Class-PersistField.html#PersistField" class="link">Source</a></p><div class="doc"><p>A value which can be marshalled to and from a <code><a href="Database-Persist-Types.html#t:PersistValue">PersistValue</a></code>.</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:toPersistValue" class="def">toPersistValue</a> :: a -> <a href="Database-Persist-Types.html#t:PersistValue">PersistValue</a> <a href="src/Database-Persist-Class-PersistField.html#toPersistValue" class="link">Source</a></p><p class="src"><a name="v:fromPersistValue" class="def">fromPersistValue</a> :: <a href="Database-Persist-Types.html#t:PersistValue">PersistValue</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> a <a href="src/Database-Persist-Class-PersistField.html#fromPersistValue" class="link">Source</a></p></div><div class="subs instances"><p id="control.i:PersistField" class="caption collapser" onclick="toggleSection('i:PersistField')">Instances</p><div id="section.i:PersistField" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-202" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Double">Double</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-171" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-104" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int8">Int8</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-110" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int16">Int16</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-119" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int32">Int32</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-128" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-137" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-188" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word">Word</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-146" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word8">Word8</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-151" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word16">Word16</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-156" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word32">Word32</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-161" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word64">Word64</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-166" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-68" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-87" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-92" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/time-1.5.0.1/Data-Time-Clock.html#t:UTCTime">UTCTime</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-239" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text-Lazy.html#t:Text">Text</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-96" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Numeric-Natural.html#t:Natural">Natural</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-262" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/libghc-blaze-html-doc/html/Text-Blaze-Html.html#t:Html">Html</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-100" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/time-1.5.0.1/Data-Time-LocalTime.html#t:TimeOfDay">TimeOfDay</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-226" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/time-1.5.0.1/Data-Time-Calendar.html#t:Day">Day</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-212" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="Database-Persist-Types.html#t:PersistValue">PersistValue</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-316" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="Database-Persist-Types.html#t:Checkmark">Checkmark</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-349" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> <a href="Database-Persist-Types.html#t:SomePersistField">SomePersistField</a></span> <a href="src/Database-Persist-Class-PersistField.html#line-345" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> a => <a href="Database-Persist-Class.html#t:PersistField">PersistField</a> [a]</span> <a href="src/Database-Persist-Class-PersistField.html#line-273" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> a => <a href="Database-Persist-Class.html#t:PersistField">PersistField</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</span> <a href="src/Database-Persist-Class-PersistField.html#line-267" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Fixed.html#t:HasResolution">HasResolution</a> a => <a href="Database-Persist-Class.html#t:PersistField">PersistField</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Fixed.html#t:Fixed">Fixed</a> a)</span> <a href="src/Database-Persist-Class-PersistField.html#line-178" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> v => <a href="Database-Persist-Class.html#t:PersistField">PersistField</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.6.2/Data-IntMap-Strict.html#t:IntMap">IntMap</a> v)</span> <a href="src/Database-Persist-Class-PersistField.html#line-308" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Ord.html#t:Ord">Ord</a> a, <a href="Database-Persist-Class.html#t:PersistField">PersistField</a> a) => <a href="Database-Persist-Class.html#t:PersistField">PersistField</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.6.2/Data-Set.html#t:Set">Set</a> a)</span> <a href="src/Database-Persist-Class-PersistField.html#line-289" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> a => <a href="Database-Persist-Class.html#t:PersistField">PersistField</a> (<a href="file:///usr/share/doc/libghc-vector-doc/html/Data-Vector.html#t:Vector">Vector</a> a)</span> <a href="src/Database-Persist-Class-PersistField.html#line-284" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> record, <a href="Database-Persist-Class.html#t:PersistField">PersistField</a> record, <a href="Database-Persist-Class.html#t:PersistField">PersistField</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record)) => <a href="Database-Persist-Class.html#t:PersistField">PersistField</a> (<a href="Database-Persist-Types.html#t:Entity">Entity</a> record)</span> <a href="src/Database-Persist-Class-PersistField.html#line-248" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Database-Persist-Class.html#t:PersistField">PersistField</a> a, <a href="Database-Persist-Class.html#t:PersistField">PersistField</a> b) => <a href="Database-Persist-Class.html#t:PersistField">PersistField</a> (a, b)</span> <a href="src/Database-Persist-Class-PersistField.html#line-300" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:PersistField">PersistField</a> v => <a href="Database-Persist-Class.html#t:PersistField">PersistField</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.6.2/Data-Map-Lazy.html#t:Map">Map</a> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> v)</span> <a href="src/Database-Persist-Class-PersistField.html#line-312" class="link">Source</a></td><td class="doc empty"> </td></tr></table></div></div></div><h1 id="g:7">PersistConfig</h1><div class="top"><p class="src"><span class="keyword">class</span> <a name="t:PersistConfig" class="def">PersistConfig</a> c <span class="keyword">where</span> <a href="src/Database-Persist-Class-PersistConfig.html#PersistConfig" class="link">Source</a></p><div class="doc"><p>Represents a value containing all the configuration options for a specific
backend. This abstraction makes it easier to write code that can easily swap
backends.</p></div><div class="subs minimal"><p class="caption">Minimal complete definition</p><p class="src"><a href="Database-Persist-Class.html#v:loadConfig">loadConfig</a>, <a href="Database-Persist-Class.html#v:createPoolConfig">createPoolConfig</a>, <a href="Database-Persist-Class.html#v:runPool">runPool</a></p></div><div class="subs associated-types"><p class="caption">Associated Types</p><p class="src"><span class="keyword">type</span> <a name="t:PersistConfigBackend" class="def">PersistConfigBackend</a> c :: (* -> *) -> * -> * <a href="src/Database-Persist-Class-PersistConfig.html#PersistConfigBackend" class="link">Source</a></p><p class="src"><span class="keyword">type</span> <a name="t:PersistConfigPool" class="def">PersistConfigPool</a> c <a href="src/Database-Persist-Class-PersistConfig.html#PersistConfigPool" class="link">Source</a></p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:loadConfig" class="def">loadConfig</a> :: <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:Value">Value</a> -> <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:Parser">Parser</a> c <a href="src/Database-Persist-Class-PersistConfig.html#loadConfig" class="link">Source</a></p><div class="doc"><p>Load the config settings from a <code><a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:Value">Value</a></code>, most likely taken from a YAML
config file.</p></div><p class="src"><a name="v:applyEnv" class="def">applyEnv</a> :: c -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> c <a href="src/Database-Persist-Class-PersistConfig.html#applyEnv" class="link">Source</a></p><div class="doc"><p>Modify the config settings based on environment variables.</p></div><p class="src"><a name="v:createPoolConfig" class="def">createPoolConfig</a> :: c -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> (<a href="Database-Persist-Class.html#t:PersistConfigPool">PersistConfigPool</a> c) <a href="src/Database-Persist-Class-PersistConfig.html#createPoolConfig" class="link">Source</a></p><div class="doc"><p>Create a new connection pool based on the given config settings.</p></div><p class="src"><a name="v:runPool" class="def">runPool</a> :: (<a href="file:///usr/share/doc/libghc-monad-control-doc/html/Control-Monad-Trans-Control.html#t:MonadBaseControl">MonadBaseControl</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m) => c -> <a href="Database-Persist-Class.html#t:PersistConfigBackend">PersistConfigBackend</a> c m a -> <a href="Database-Persist-Class.html#t:PersistConfigPool">PersistConfigPool</a> c -> m a <a href="src/Database-Persist-Class-PersistConfig.html#runPool" class="link">Source</a></p><div class="doc"><p>Run a database action by taking a connection from the pool.</p></div></div><div class="subs instances"><p id="control.i:PersistConfig" class="caption collapser" onclick="toggleSection('i:PersistConfig')">Instances</p><div id="section.i:PersistConfig" class="show"><table><tr><td class="src clearfix"><span class="inst-left">(<a href="Database-Persist-Class.html#t:PersistConfig">PersistConfig</a> c1, <a href="Database-Persist-Class.html#t:PersistConfig">PersistConfig</a> c2, (~) * (<a href="Database-Persist-Class.html#t:PersistConfigPool">PersistConfigPool</a> c1) (<a href="Database-Persist-Class.html#t:PersistConfigPool">PersistConfigPool</a> c2), (~) ((* -> *) -> * -> *) (<a href="Database-Persist-Class.html#t:PersistConfigBackend">PersistConfigBackend</a> c1) (<a href="Database-Persist-Class.html#t:PersistConfigBackend">PersistConfigBackend</a> c2)) => <a href="Database-Persist-Class.html#t:PersistConfig">PersistConfig</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> c1 c2)</span> <a href="src/Database-Persist-Class-PersistConfig.html#line-41" class="link">Source</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:entityValues" class="def">entityValues</a> :: <a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> record => <a href="Database-Persist-Types.html#t:Entity">Entity</a> record -> [<a href="Database-Persist-Types.html#t:PersistValue">PersistValue</a>] <a href="src/Database-Persist-Class-PersistEntity.html#entityValues" class="link">Source</a></p></div><h1 id="g:8">Lifting</h1><div class="top"><p class="src"><span class="keyword">class</span> <a name="t:HasPersistBackend" class="def">HasPersistBackend</a> env backend | env -> backend <span class="keyword">where</span> <a href="src/Database-Persist-Class-PersistStore.html#HasPersistBackend" class="link">Source</a></p><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:persistBackend" class="def">persistBackend</a> :: env -> backend <a href="src/Database-Persist-Class-PersistStore.html#persistBackend" class="link">Source</a></p></div><div class="subs instances"><p id="control.i:HasPersistBackend" class="caption collapser" onclick="toggleSection('i:HasPersistBackend')">Instances</p><div id="section.i:HasPersistBackend" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="Database-Persist-Class.html#t:HasPersistBackend">HasPersistBackend</a> <a href="Database-Persist-Sql.html#t:SqlBackend">SqlBackend</a> <a href="Database-Persist-Sql.html#t:SqlBackend">SqlBackend</a></span> <a href="src/Database-Persist-Class-PersistStore.html#line-62" class="link">Source</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:liftPersist" class="def">liftPersist</a> :: (<a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader-Class.html#t:MonadReader">MonadReader</a> env m, <a href="Database-Persist-Class.html#t:HasPersistBackend">HasPersistBackend</a> env backend, <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m) => <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> backend <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> a -> m a <a href="src/Database-Persist-Class-PersistStore.html#liftPersist" class="link">Source</a></p></div><h1 id="g:9">JSON utilities</h1><div class="top"><p class="src"><a name="v:keyValueEntityToJSON" class="def">keyValueEntityToJSON</a> :: (<a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> record, <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:ToJSON">ToJSON</a> record, <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:ToJSON">ToJSON</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record)) => <a href="Database-Persist-Types.html#t:Entity">Entity</a> record -> <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:Value">Value</a> <a href="src/Database-Persist-Class-PersistEntity.html#keyValueEntityToJSON" class="link">Source</a></p><div class="doc"><p>Predefined <code>toJSON</code>. The resulting JSON looks like
<code>{"key": 1, "value": {"name": ...}}</code>.</p><p>The typical usage is:</p><pre> instance ToJSON (Entity User) where
toJSON = keyValueEntityToJSON
</pre></div></div><div class="top"><p class="src"><a name="v:keyValueEntityFromJSON" class="def">keyValueEntityFromJSON</a> :: (<a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> record, <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:FromJSON">FromJSON</a> record, <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:FromJSON">FromJSON</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record)) => <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:Value">Value</a> -> <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:Parser">Parser</a> (<a href="Database-Persist-Types.html#t:Entity">Entity</a> record) <a href="src/Database-Persist-Class-PersistEntity.html#keyValueEntityFromJSON" class="link">Source</a></p><div class="doc"><p>Predefined <code>parseJSON</code>. The input JSON looks like
<code>{"key": 1, "value": {"name": ...}}</code>.</p><p>The typical usage is:</p><pre> instance FromJSON (Entity User) where
parseJSON = keyValueEntityFromJSON
</pre></div></div><div class="top"><p class="src"><a name="v:entityIdToJSON" class="def">entityIdToJSON</a> :: (<a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> record, <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:ToJSON">ToJSON</a> record, <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:ToJSON">ToJSON</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record)) => <a href="Database-Persist-Types.html#t:Entity">Entity</a> record -> <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:Value">Value</a> <a href="src/Database-Persist-Class-PersistEntity.html#entityIdToJSON" class="link">Source</a></p><div class="doc"><p>Predefined <code>toJSON</code>. The resulting JSON looks like
<code>{"id": 1, "name": ...}</code>.</p><p>The typical usage is:</p><pre> instance ToJSON (Entity User) where
toJSON = entityIdToJSON
</pre></div></div><div class="top"><p class="src"><a name="v:entityIdFromJSON" class="def">entityIdFromJSON</a> :: (<a href="Database-Persist-Class.html#t:PersistEntity">PersistEntity</a> record, <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:FromJSON">FromJSON</a> record, <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:FromJSON">FromJSON</a> (<a href="Database-Persist-Class.html#t:Key">Key</a> record)) => <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:Value">Value</a> -> <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:Parser">Parser</a> (<a href="Database-Persist-Types.html#t:Entity">Entity</a> record) <a href="src/Database-Persist-Class-PersistEntity.html#entityIdFromJSON" class="link">Source</a></p><div class="doc"><p>Predefined <code>parseJSON</code>. The input JSON looks like
<code>{"id": 1, "name": ...}</code>.</p><p>The typical usage is:</p><pre> instance FromJSON (Entity User) where
parseJSON = entityIdFromJSON
</pre></div></div><div class="top"><p class="src"><a name="v:toPersistValueJSON" class="def">toPersistValueJSON</a> :: <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:ToJSON">ToJSON</a> a => a -> <a href="Database-Persist-Types.html#t:PersistValue">PersistValue</a> <a href="src/Database-Persist-Class-PersistEntity.html#toPersistValueJSON" class="link">Source</a></p><div class="doc"><p>Convenience function for getting a free <code><a href="Database-Persist-Class.html#t:PersistField">PersistField</a></code> instance
from a type with JSON instances.</p><p>Example usage in combination with<code><a href="Database-Persist-Class.html#v:fromPersistValueJSON">fromPersistValueJSON</a></code>:</p><pre>instance PersistField MyData where
fromPersistValue = fromPersistValueJSON
toPersistValue = toPersistValueJSON
</pre></div></div><div class="top"><p class="src"><a name="v:fromPersistValueJSON" class="def">fromPersistValueJSON</a> :: <a href="file:///usr/share/doc/libghc-aeson-doc/html/Data-Aeson-Types.html#t:FromJSON">FromJSON</a> a => <a href="Database-Persist-Types.html#t:PersistValue">PersistValue</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> a <a href="src/Database-Persist-Class-PersistEntity.html#fromPersistValueJSON" class="link">Source</a></p><div class="doc"><p>Convenience function for getting a free <code><a href="Database-Persist-Class.html#t:PersistField">PersistField</a></code> instance
from a type with JSON instances. The JSON parser used will accept
JSON values other that object and arrays. So, if your instance
serializes the data to a JSON string, this will still work.</p><p>Example usage in combination with<code><a href="Database-Persist-Class.html#v:toPersistValueJSON">toPersistValueJSON</a></code>:</p><pre>instance PersistField MyData where
fromPersistValue = fromPersistValueJSON
toPersistValue = toPersistValueJSON
</pre></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>
|