postgrest-js
postgrest-js copied to clipboard
Handle column name embed
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
@steve-chavez this one is also rebased and improved