-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Idea: Generators #135
Comments
I dont see the connection with #36. for example to send back all the rows in a database table without loading the full table into the servers memory. export async function* bigQuery() {
const cursor = sql`select * from bigTable`.cursor()
for await (const [row] of cursor) {
yield row;
}
} for await (const row of bigQuery()) {
// do something with the row
}
console.log('all rows loaded') I saw elysia doing this and though it was a briliant way to handle streaming responses. side note, I really like the framework agnostic way you integrate with servers. made hooking up to elysia easy. |
an alternative to this might be returning a stream from a normal function, but I like the generator interface better. |
I see, make sense and I like it as well. |
It would be awesome if when we returned a generator from a telefunc file it would wrap it in Server Sent Events
page.telefunc.ts
page.tsx
The text was updated successfully, but these errors were encountered: