hasql-streams-streamly (empty) → 0.1.0.0
raw patch · 3 files changed
+80/−0 lines, 3 filesdep +basedep +hasqldep +hasql-streams-core
Dependencies added: base, hasql, hasql-streams-core, hasql-transaction-io, streamly, transformers
Files
- LICENSE +20/−0
- hasql-streams-streamly.cabal +30/−0
- library/Hasql/Streamly.hs +30/−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-streamly.cabal view
@@ -0,0 +1,30 @@+cabal-version: 2.4+name: hasql-streams-streamly+version: 0.1.0.0+synopsis: Stream Hasql queries with Streamly+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, Streamly++source-repository head+ type: git+ location: https://github.com/andremarianiello/hasql-streams.git++library+ exposed-modules: Hasql.Streamly+ 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+ , streamly ^>=0.8.1+ , transformers ^>=0.5.6++ hs-source-dirs: library+ default-language: Haskell2010
+ library/Hasql/Streamly.hs view
@@ -0,0 +1,30 @@+module Hasql.Streamly (+ streamlyQuery,+) where++-- transformers+import Control.Monad.Trans.Class++-- streamly+import qualified Streamly.Prelude as Streamly+import qualified Streamly.Internal.Data.Stream.Serial as Serial++-- hasql+import Hasql.Statement++-- hasql-transaction-io+import Hasql.CursorTransactionIO++-- hasql-streams-core+import Hasql.Streams++-- | Run a `Statement`, but return a instance of `Streamly.IsStream` instead of a list+streamlyQuery ::+ (Streamly.IsStream t) => + Statement params [a] -> params -> t (CursorTransactionIO s) a+streamlyQuery stmt params = cursorStreamQuery stmt params foldStreamlyStream++foldStreamlyStream ::+ (Streamly.IsStream t) =>+ CursorStreamFold s a (t (CursorTransactionIO s) a)+foldStreamlyStream step init = Streamly.adapt (lift init >>= Serial.unfoldrM step)