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

Handle column name embed

Open wyozi opened this issue 1 year ago • 1 comments

What kind of change does this PR introduce?

Handle column name as target. See column name section at https://postgrest.org/en/stable/references/api/resource_embedding.html#embedding-disambiguation

What is the new behavior?

When a many-to-one relationship from messages->users exists in form of user_id foreign-key in messages, this change allows using the following form to type-safely embed a user:

client.from("messages").select("user:user_id(name)")

This was previously only possible by using a relationship name as the target or by using a foreign key name as a hint

Additional context

fixes #450

wyozi avatar Jul 26 '23 09:07 wyozi

@steve-chavez this one is also rebased and improved

wyozi avatar Mar 12 '24 12:03 wyozi