Skip to content

Commit 2798d03

Browse files
committed
cleanups
1 parent 45d86b1 commit 2798d03

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface RunResult {
1212
duration: number
1313
lastInsertRowid: number
1414
}
15+
/** Retrieve next row from an iterator synchronously. Needed for better-sqlite3 API compatibility. */
1516
export declare function iteratorNextSync(iter: RowsIterator): Record
1617
export declare class SqliteError {
1718
message: string
@@ -48,6 +49,7 @@ export declare class Statement {
4849
safeIntegers(toggle?: boolean | undefined | null): this
4950
interrupt(): void
5051
}
52+
/** A raw iterator over rows. The JavaScript layer wraps this in a iterable. */
5153
export declare class RowsIterator {
5254
next(): Promise<Record>
5355
}

src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ mod auth;
77
#[macro_use]
88
extern crate napi_derive;
99

10-
use libsql::Row;
1110
use napi::bindgen_prelude::{Array, FromNapiValue, ToNapiValue};
1211
use napi::{Env, JsUnknown, Result, ValueType};
1312
use once_cell::sync::OnceCell;
@@ -642,14 +641,13 @@ impl Statement {
642641
Ok::<_, napi::Error>((rows, column_names))
643642
};
644643
let (rows, column_names) = rt.block_on(future)?;
645-
let iter = RowsIterator::new(
644+
Ok(RowsIterator::new(
646645
Arc::new(tokio::sync::Mutex::new(rows)),
647646
column_names,
648647
safe_ints,
649648
raw,
650649
pluck,
651-
)?;
652-
Ok(iter)
650+
))
653651
}
654652

655653
#[napi]

0 commit comments

Comments
 (0)