bun
bun
Explore posts from servers
KKysely
Created by bun on 2/15/2024 in #help
Why does `.stream()` return a single result when I pass in a `chunkSize` option ?
I guess I'm obligated to do something like this:
const events = db.selectFrom("events").selectAll().stream(10_000)

let currChunk = [] as Events[]

for await (const chunk of events) {
currChunk.push(chunk)

if (currChunk.length === 10_000) {
// process chunk

currChunk = []
}
}
const events = db.selectFrom("events").selectAll().stream(10_000)

let currChunk = [] as Events[]

for await (const chunk of events) {
currChunk.push(chunk)

if (currChunk.length === 10_000) {
// process chunk

currChunk = []
}
}
2 replies
KKysely
Created by bun on 9/4/2023 in #help
How to return last inserted ID ?
but how do i make it do that ?
8 replies
KKysely
Created by bun on 9/4/2023 in #help
How to return last inserted ID ?
i understood that by default postgres doesn't do that
8 replies
KKysely
Created by bun on 9/4/2023 in #help
How to return last inserted ID ?
yes, many times, didn't find anything specifically regarding last inserted id @koskimas
8 replies
KKysely
Created by bun on 6/29/2023 in #help
What's the pattern for writing migrations exactly?
locally
16 replies
KKysely
Created by bun on 6/29/2023 in #help
What's the pattern for writing migrations exactly?
then run them using a package.json script
16 replies
KKysely
Created by bun on 6/29/2023 in #help
What's the pattern for writing migrations exactly?
I'm thinking of creating a /migrations folder and an index.ts file that will include the run migration code, while there will be the migration files in the same folder. Following the iso8601timestamp-some-description.ts
16 replies
KKysely
Created by bun on 6/29/2023 in #help
What's the pattern for writing migrations exactly?
wouldn't it be an expensive computation if im running serverless? like for it to try to create the tables if they dont exist everytime a request hits on my aws lambda
16 replies
KKysely
Created by bun on 6/29/2023 in #help
What's the pattern for writing migrations exactly?
yeah
16 replies