hasql-streams-pipes (empty) → 0.1.0.0
raw patch · 3 files changed
+79/−0 lines, 3 filesdep +basedep +hasqldep +hasql-streams-core
Dependencies added: base, hasql, hasql-streams-core, hasql-transaction-io, pipes, transformers
Files
- LICENSE +20/−0
- hasql-streams-pipes.cabal +30/−0
- library/Hasql/Pipes.hs +29/−0
+ 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-pipes.cabal view
@@ -0,0 +1,30 @@+cabal-version: 2.4+name: hasql-streams-pipes+version: 0.1.0.0+synopsis: Stream Hasql queries with Pipes+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, Pipes++source-repository head+ type: git+ location: https://github.com/andremarianiello/hasql-streams.git++library+ exposed-modules: Hasql.Pipes+ default-extensions:+ build-depends:+ , base >=4.14 && <4.17+ , hasql ^>=1.5.0+ , hasql-streams-core ^>=0.1.0+ , hasql-transaction-io ^>=0.1.0+ , pipes ^>=4.3.16+ , transformers ^>=0.5.6++ hs-source-dirs: library+ default-language: Haskell2010
+ library/Hasql/Pipes.hs view
@@ -0,0 +1,29 @@+module Hasql.Pipes (+ pipesQuery,+) where++-- transformers+import Control.Monad.Trans.Class++-- pipes+import Pipes+import qualified Pipes.Prelude as Pipes++-- hasql+import Hasql.Statement++-- hasql-transaction-io+import Hasql.CursorTransactionIO++-- hasql-streams-core+import Hasql.Streams++-- | Run a `Statement`, but return a `Producer` instead of a list+pipesQuery :: Statement params [a] -> params -> Producer a (CursorTransactionIO s) ()+pipesQuery stmt params = cursorStreamQuery stmt params foldPipesStream++foldPipesStream :: CursorStreamFold s a (Producer a (CursorTransactionIO s) ())+foldPipesStream step init = lift init >>= Pipes.unfoldr (fmap maybeToEither . step)++maybeToEither :: Maybe a -> Either () a+maybeToEither = maybe (Left ()) Right