supabase-community / postgrest-kt

Postgrest Kotlin Client
53 stars 8 forks source link

Documenting Queries with foreign keys requests #2

Open lmick002 opened 3 years ago

lmick002 commented 3 years ago

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 commented 3 years ago

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

kevcodez commented 3 years ago

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