packages feed

hasql-streams-conduit (empty) → 0.1.0.0

raw patch · 3 files changed

+77/−0 lines, 3 filesdep +basedep +conduitdep +hasql

Dependencies added: base, conduit, hasql, hasql-streams-core, hasql-transaction-io, transformers

Files

+ LICENSE view
@@ -0,0 +1,20 @@+Copyright (c) 2022 Andre Marianiello++Permission is hereby granted, free of charge, to any person obtaining+a copy of this software and associated documentation files (the+"Software"), to deal in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject to+the following conditions:++The above copyright notice and this permission notice shall be included+in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ hasql-streams-conduit.cabal view
@@ -0,0 +1,30 @@+cabal-version: 2.4+name:          hasql-streams-conduit+version:       0.1.0.0+synopsis:      Stream Hasql queries with Conduit+homepage:      https://github.com/andremarianiello/hasql-streams+bug-reports:   https://github.com/andremarianiello/hasql-streams/issues+license:       MIT+license-file:  LICENSE+author:        Andre Marianiello+maintainer:    andremarianiello@users.noreply.github.com+copyright:     (c) 2022, Andre Marianiello+category:      Database, PostgreSQL, Hasql, Streaming, Conduit++source-repository head+  type:     git+  location: https://github.com/andremarianiello/hasql-streams.git++library+  exposed-modules:    Hasql.Conduit+  default-extensions:+  build-depends:+    , base                  >=4.14  && <4.17+    , conduit               ^>=1.3.4+    , hasql                 ^>=1.5.0+    , hasql-streams-core    ^>=0.1.0+    , hasql-transaction-io  ^>=0.1.0+    , transformers          ^>=0.5.6++  hs-source-dirs:     library+  default-language:   Haskell2010
+ library/Hasql/Conduit.hs view
@@ -0,0 +1,27 @@+module Hasql.Conduit (+  conduitQuery,+) where++-- transformers+import Control.Monad.Trans.Class++-- conduit+import Data.Conduit+import Data.Conduit.List++-- hasql+import Hasql.Statement++-- hasql-transaction-io+import Hasql.CursorTransactionIO++-- hasql-streams-core+import Hasql.Streams++-- | Run a `Statement`, but return a `Conduit` instead of a list+conduitQuery :: Statement params [a] -> params ->+  ConduitT () a (CursorTransactionIO s) ()+conduitQuery stmt params = cursorStreamQuery stmt params foldConduitStream++foldConduitStream :: CursorStreamFold s a (ConduitT () a (CursorTransactionIO s) ())+foldConduitStream step init = lift init >>= unfoldM step