BiffBaffBoff
BiffBaffBoff
Explore posts from servers
NNuxt
Created by BiffBaffBoff on 9/6/2024 in #❓・help
Cloudflare pages preset
Hi, if I'm hosting my nuxt app in cloudflare, do I need to still set this preset?
nitro: {
preset: 'cloudflare-pages',
},
nitro: {
preset: 'cloudflare-pages',
},
The reason I ask, is that I want to do some image manipulation in my api route so I'm using sharp but this doesnt seem compatible when I use that preset? I guess this is out of the realm of here - but - is there another image manipulation library I can do which is compatible with cloudflare pages environment? Thanks
1 replies
DTDrizzle Team
Created by BiffBaffBoff on 1/5/2024 in #help
Aggregation with Query API
Hi, is it possible to do aggregation via the query API? I have to do the following at the moment, then I do a form.submissions.length to get the current count. Can it be simplified?
const res = await db.query.formsTbl.findMany({
where: (forms, { eq }) => eq(forms.createdBy, user.userId),
with: {
submissions: {
columns: {
id: true,
},
},
},
})
const res = await db.query.formsTbl.findMany({
where: (forms, { eq }) => eq(forms.createdBy, user.userId),
with: {
submissions: {
columns: {
id: true,
},
},
},
})
Thanks
3 replies
DTDrizzle Team
Created by BiffBaffBoff on 12/20/2023 in #help
How to use the Batch API?
Hi, I am using Turso and have an array of people I need to insert into my database. I've tried via db.insert(people).values(peopleArray) but get an error about too many variables or something so then I looked into the batch API, but this doesnt work either:
db.batch(peopleArray.map(p => db.insert(people).values(p))
db.batch(peopleArray.map(p => db.insert(people).values(p))
But I can do something like this which works for a single entry?
const person = { id: 1, name: "Tester" }
const ins = db.insert(people).values(person)
db.batch([ins])
const person = { id: 1, name: "Tester" }
const ins = db.insert(people).values(person)
db.batch([ins])
So why can't I do something similar with an array?
7 replies