MCPcopy Create free account
hub / github.com/Effect-TS/effect / stream

Function stream

packages/sql/sqlite-wasm/src/SqliteClient.ts:233–247  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

231 },
232 executeStream(sql, params, transformRows) {
233 function* stream() {
234 for (const stmt of sqlite3.statements(db, sql)) {
235 let columns: Array<string> | undefined
236 sqlite3.bind_collection(stmt, params as any)
237 while (sqlite3.step(stmt) === WaSqlite.SQLITE_ROW) {
238 columns = columns ?? sqlite3.column_names(stmt)
239 const row = sqlite3.row(stmt)
240 const obj: Record<string, any> = {}
241 for (let i = 0; i < columns.length; i++) {
242 Rec.assignProperty(obj, columns[i], row[i])
243 }
244 yield obj
245 }
246 }
247 }
248 return Stream.suspend(() => Stream.fromIteratorSucceed(stream()[Symbol.iterator]())).pipe(
249 transformRows
250 ? Stream.mapArray((chunk) => transformRows(chunk) as any)

Callers 1

executeStreamFunction · 0.70

Calls 1

stepMethod · 0.65

Tested by

no test coverage detected