Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle column name embed #451

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

wyozi
Copy link
Contributor

@wyozi wyozi commented Jul 26, 2023

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
Copy link
Contributor Author

wyozi commented Mar 12, 2024

@steve-chavez this one is also rebased and improved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Types for column name disambiguation
1 participant