Module: ROM::Plugins::Relation::SQL::Postgres::Streaming

Extended by:
Notifications::Listener
Defined in:
lib/rom/plugins/relation/sql/postgres/streaming.rb

Overview

PG-specific extensions which adds Relation#stream method

Defined Under Namespace

Modules: Combined, Composite Classes: StreamingNotSupportedError

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object


36
37
38
39
40
# File 'lib/rom/plugins/relation/sql/postgres/streaming.rb', line 36

def self.included(klass)
  super
  ROM::Relation::Graph.include(Combined)
  ROM::Relation::Composite.include(Composite)
end

Instance Method Details

#stream_eachRelation

Allows you to stream returned rows one at a time, instead of collecting the entire result set in memory. Requires the sequel_pg gem

Examples:

posts.stream_each { |post| puts CSV.generate_line(post) }

Returns:

See Also:


54
55
56
# File 'lib/rom/plugins/relation/sql/postgres/streaming.rb', line 54

def stream_each
  raise StreamingNotSupportedError, "not supported on jruby"
end