valiant-conduit: Conduit streaming adapter for valiant

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

Stream PostgreSQL query results as Conduit sources. Provides cursor-based streaming via selectSource and single-shot streaming via foldSource, both producing ConduitT () r IO () values compatible with the conduit ecosystem.


[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), conduit (>=1.3 && <1.4), 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:03Z
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-conduit)
Distributions
Downloads 2 total (2 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-conduit-0.1.0.0

[back to package description]

valiant-conduit

Conduit streaming adapter for valiant.

Produces ConduitT () r IO () values from query results, so query output composes with the rest of the conduit ecosystem.

Quick start

import Valiant
import Valiant.Conduit
import Conduit

countActiveUsers :: Pool -> IO Int
countActiveUsers pool =
  withTransaction pool $ \tx ->
    runConduit $
      selectSource (txConn tx) listAllUsers () 500
      .| filterC userActive
      .| lengthC

Two streaming strategies

  • selectSource conn stmt params batchSize — cursor-based. Must run inside a transaction. Fetches in batches of batchSize rows.
  • foldSource conn stmt params — single-shot extended-protocol query. No transaction required.

Both functions accumulate one result set at a time before yielding, so memory usage scales with the active batch (cursor) or the full result set (foldSource). For truly incremental memory use across a large cursor, drive Valiant.withCursor / Valiant.fetchBatch yourself.

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