MVFM

postgres/cursor_batch

Access the current batch of rows inside a cursor callback

const app = mvfm(prelude, console_, pg);
const prog = app({}, ($) => {
  const query = $.sql`SELECT name, email FROM users ORDER BY id`;
  return $.sql.cursor(query, 1, (batch) => {
    return $.console.log("row:", batch);
  });
});
await fold(defaults(app, { postgres: wasmPgInterpreter }), prog);
Initializing database...