BiffBaffBoff
BiffBaffBoff
Explore posts from servers
DTDrizzle Team
Created by BiffBaffBoff on 12/20/2023 in #help
How to use the Batch API?
Ah nvm, sorry it does work, needed to do this:
if (isTuple(ins)) {
await db.batch(ins)
}
if (isTuple(ins)) {
await db.batch(ins)
}
Thanks again for your help
7 replies
DTDrizzle Team
Created by BiffBaffBoff on 12/20/2023 in #help
How to use the Batch API?
Hiya, thanks for the reply but that still doesnt work:
function isTuple<T>(array: T[]): array is [T, ...T[]] {
return array.length > 0
}
function isTuple<T>(array: T[]): array is [T, ...T[]] {
return array.length > 0
}
Further down:
if (isTuple(peopleArray)) {
const ins = peopleArray.map((p) => db.insert(people).values(p))
await db.batch(ins)
}
if (isTuple(peopleArray)) {
const ins = peopleArray.map((p) => db.insert(people).values(p))
await db.batch(ins)
}
Error: Source provides no match for required element at position 0 in target
7 replies