File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -129,9 +129,7 @@ function Connection(options = {}) {
129129 function onready ( err ) {
130130 err
131131 ? ( backend . query ? backend . query . reject ( err ) : error ( err ) )
132- : ( backend . query && backend . query . resolve ( backend . query . stream
133- ? backend . query . result . count
134- : ( backend . query . results || backend . query . result ) ) )
132+ : ( backend . query && backend . query . resolve ( backend . query . results || backend . query . result ) )
135133
136134 backend . query = backend . error = null
137135 timeout && queries . length === 0 && idle ( )
Original file line number Diff line number Diff line change @@ -735,6 +735,16 @@ t('bytea serializes and parses', async() => {
735735 return [ 0 , Buffer . compare ( buf , ( await sql `select x from test` ) [ 0 ] . x ) ]
736736} )
737737
738+ t ( 'Stream works' , async ( ) => {
739+ let result
740+ await sql `select 1 as x` . stream ( ( { x } ) => result = x )
741+ return [ 1 , result ]
742+ } )
743+
744+ t ( 'Stream returns empty array' , async ( ) => {
745+ return [ 0 , ( await sql `select 1 as x` . stream ( x => { } ) ) . length ]
746+ } )
747+
738748t ( 'Transform row' , async ( ) => {
739749 const sql = postgres ( {
740750 ...options ,
You can’t perform that action at this time.
0 commit comments