hasql-streams-streaming (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, streaming, transformers
Files
- LICENSE +20/−0
- hasql-streams-streaming.cabal +30/−0
- library/Hasql/Streaming.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-streaming.cabal view
@@ -0,0 +1,30 @@+cabal-version: 2.4+name: hasql-streams-streaming+version: 0.1.0.0+synopsis: Stream Hasql queries with Streaming+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++source-repository head+ type: git+ location: https://github.com/andremarianiello/hasql-streams.git++library+ exposed-modules: Hasql.Streaming+ 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+ , streaming ^>=0.2.3+ , transformers ^>=0.5.6++ hs-source-dirs: library+ default-language: Haskell2010
+ library/Hasql/Streaming.hs view
@@ -0,0 +1,29 @@+module Hasql.Streaming (+ streamingQuery,+) where++-- streaming+import Streaming+import Streaming.Prelude as Streaming++-- hasql+import Hasql.Statement++-- hasql-transaction-io+import Hasql.CursorTransactionIO++-- hasql-streaming+import Hasql.Streams++-- | Run a `Statement`, but return a `Stream` instead of a list+streamingQuery :: + Statement params [a] -> params ->+ Stream (Of a) (CursorTransactionIO s) ()+streamingQuery stmt params = cursorStreamQuery stmt params foldStreamingStream++foldStreamingStream ::+ CursorStreamFold s a (Stream (Of a) (CursorTransactionIO s) ())+foldStreamingStream step init = lift init >>= Streaming.unfoldr (fmap maybeToEither . step)++maybeToEither :: Maybe a -> Either () a+maybeToEither = maybe (Left ()) Right