Skip to content

SqlStream

Low-level helpers for adapting push-based SQL row sources into Effect streams.

SQL drivers often expose large query results through cursors, event emitters, or driver-specific streams that push rows as they arrive. This module provides the small interop layer used by SQL integrations to turn those producers into Stream values for Statement.stream and Connection.executeStream, so callers can process large result sets incrementally instead of materializing every row in memory.

1 exports Added in v4.0.0 Source

Constructors

Creates a stream from a callback-style producer with pause and resume callbacks that are triggered when the internal queue applies backpressure.

Signature

declare function asyncPauseResume<A, E = never, R = never>(register: (emit: {
  readonly array: (arr: readonly Array<A>) => void;
  readonly end: () => void;
  readonly fail: (error: E) => void;
  readonly single: (item: A) => void;
}) => Effect<{
  onPause(): void;
  onResume(): void;
}, E, Scope | R>, bufferSize: number): Stream<A, E, R>