postgrest-kt icon indicating copy to clipboard operation
postgrest-kt copied to clipboard

Documenting Queries with foreign keys requests

Open lmick002 opened this issue 4 years ago • 2 comments

Improve documentation

https://github.com/supabase/postgrest-kt

Documentation showing how to use foreign keys within postgres-kt select statements would be beneficial, especially for those not experienced with the library.

Reference code showing the foreign key usage would be greatly appreciated. Thanks!

lmick002 avatar Apr 17 '21 02:04 lmick002

For more context here's our query that we're trying to adapt to the postrgres-kt library from the javascript library.

`

const { data: profile, error } = await db.from("profiles") .select( *, tools: tools_user_id_fkey(*), shops: shops_user_id_fkey(*) ) .eq('id', id) .is('deleted_at', null) .single();`

But it's not returning the tools & shops related to the profile

lmick002 avatar Apr 17 '21 15:04 lmick002

I need to have a look at how the JS client does this, definitely haven't tested it. If you figure this out, feel free to contribute a PR as time is pretty tight on my side ATM

kevcodez avatar Apr 29 '21 07:04 kevcodez