valiant-streaming: Streaming adapter for valiant (streaming library)

[ bsd3, database, library ] [ Propose Tags ] [ Report a vulnerability ]

Stream PostgreSQL query results using the streaming library. Provides cursor-based and fold-based producers as Stream (Of r) IO () values.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Flags

Manual Flags

NameDescriptionDefault
werror

Enable -Werror for development builds.

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0
Change log CHANGELOG.md
Dependencies base (>=4.17 && <5), streaming (>=0.2 && <0.3), valiant (>=0.1 && <0.2) [details]
Tested with ghc ==9.10.3
License BSD-3-Clause
Author Josh Burgess
Maintainer joshburgess.webdev@gmail.com
Uploaded by joshburgess at 2026-04-27T22:39:05Z
Category Database
Home page https://github.com/joshburgess/valiant
Bug tracker https://github.com/joshburgess/valiant/issues
Source repo head: git clone https://github.com/joshburgess/valiant(adapters/valiant-streaming)
Distributions
Downloads 3 total (3 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2026-04-28 [all 1 reports]

Readme for valiant-streaming-0.1.0.0

[back to package description]

valiant-streaming

streaming adapter for valiant.

Produces Stream (Of r) IO () values from query results.

Quick start

import Valiant
import Valiant.Stream
import Streaming.Prelude qualified as S

countUsers :: Pool -> IO Int
countUsers pool =
  withTransaction pool $ \tx ->
    S.length_ $ selectStream (txConn tx) listAllUsers () 500

Two streaming strategies

  • selectStream conn stmt params batchSize — cursor-based. Must run inside a transaction.
  • foldStream conn stmt params — single-shot extended-protocol query. No transaction required.

Both functions accumulate one result set at a time before yielding. For truly incremental memory use, drive Valiant.withCursor / Valiant.fetchBatch directly.

See the valiant tutorial for Statement definitions and the valiant prepare workflow.