kalil
kalil
KKysely
Created by kalil on 3/12/2024 in #help
Error when destructuring QueryCreator in withRecursive
given that the documentation has plenty of examples of destructuring to assign selectFrom (e.g. https://kysely.dev/docs/examples/WHERE/complex-where-clause), I think it was a pretty reasonable assumption that I'd be able to use that same pattern in the withRecursive callback. Is it just the QueryCreator that I should be cautious about destructuring?
9 replies
KKysely
Created by kalil on 3/12/2024 in #help
Error when destructuring QueryCreator in withRecursive
yeah, i understand now. in case anyone else makes the same mistake as me: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this#function_context
9 replies
KKysely
Created by kalil on 3/12/2024 in #help
Error when destructuring QueryCreator in withRecursive
Okay well I've figured out how to fix this one but still don't really understand it. In the playground link above if you replace this code
const pub: FlatPub | undefined = await db
.withRecursive("children", ({ selectFrom }) => {
return selectFrom("pubs")
const pub: FlatPub | undefined = await db
.withRecursive("children", ({ selectFrom }) => {
return selectFrom("pubs")
with
const pub: FlatPub | undefined = await db
.withRecursive("children", (qc) => {
return qc.selectFrom("pubs")
const pub: FlatPub | undefined = await db
.withRecursive("children", (qc) => {
return qc.selectFrom("pubs")
Kysely is able to compile the query successfully. Can anyone help me understand why? Working query: https://kyse.link/+&11H
9 replies
KKysely
Created by kalil on 3/12/2024 in #help
Error when destructuring QueryCreator in withRecursive
I realize there's a lot in this playground link (including some extraneous comments, sorry!) so I don't necessarily expect a solution. But any advice about this kind of error would be very helpful!
9 replies