File tree Expand file tree Collapse file tree 3 files changed +26
-4
lines changed Expand file tree Collapse file tree 3 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -319,7 +319,7 @@ export namespace types {
319319 toString ( ) : string ;
320320 }
321321
322- interface ResultSet extends Iterator < Row > {
322+ interface ResultSet extends Iterable < Row > , AsyncIterable < Row > {
323323 info : {
324324 queriedHost : string ,
325325 triedHosts : { [ key : string ] : any ; } ,
Original file line number Diff line number Diff line change 22 "compilerOptions" : {
33 "module" : " commonjs" ,
44 "lib" : [" es2015" ],
5- "target" : " es5 " ,
5+ "target" : " es2015 " ,
66 "sourceMap" : false ,
77 "strict" : true
88 },
Original file line number Diff line number Diff line change 1414 * limitations under the License.
1515 */
1616
17- import { types } from "../../../index" ;
17+ import { types , Client } from "../../../index" ;
1818import Uuid = types . Uuid ;
1919import TimeUuid = types . TimeUuid ;
2020import Long = types . Long ;
2121import BigDecimal = types . BigDecimal ;
2222import InetAddress = types . InetAddress ;
2323import Tuple = types . Tuple ;
24+ import ResultSet = types . ResultSet ;
25+ import Row = types . Row ;
2426
2527/*
2628 * TypeScript definitions compilation tests for types module.
2729 */
2830
29- function myTest ( ) : void {
31+ async function myTest ( ) : Promise < void > {
3032 let id :Uuid ;
3133 let tid :TimeUuid ;
3234 let b : boolean ;
3335 let s : string ;
3436 let buffer : Buffer ;
37+ let rs : ResultSet ;
3538
3639 types . protocolVersion . isSupported ( types . protocolVersion . v4 ) ;
3740
@@ -61,4 +64,23 @@ function myTest(): void {
6164 long . div ( long ) ;
6265 // Use constructor
6366 long = new Long ( 1 , 2 ) ;
67+
68+ const client = new Client ( {
69+ contactPoints : [ 'host1' ] ,
70+ localDataCenter : 'dc1'
71+ } ) ;
72+
73+ rs = await client . execute ( 'SELECT * FROM ks1.table1' ) ;
74+ // Test iteration
75+ for ( const row of rs ) {
76+ // Check is of type Row
77+ const r : Row = row ;
78+ }
79+
80+ rs = await client . execute ( 'SELECT * FROM ks1.table1' ) ;
81+ // Test async iteration
82+ for await ( const row of rs ) {
83+ // Check is of type Row
84+ const r : Row = row ;
85+ }
6486}
You can’t perform that action at this time.
0 commit comments