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

Introduce new experimental DSL for Postgrest Columns #761

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jan-tennert
Copy link
Collaborator

@jan-tennert jan-tennert commented Oct 18, 2024

What kind of change does this PR introduce?

Feature.

What is the new behavior?

Introduces a new type-safe DSL for specifying columns when making a postgrest request. Example:

supabase.from("movies").select(Columns {
    //Basic columns
    named("name", "id" withType "text")
    
    //Foreign columns
    foreign("actors") {
        named("name")
    }
    foreign("studios" withAlias "studio") {
        named("name")
    }
    //Or spread within the response
    foreign("studios") {
        spread = true
        named("name" withAlias "studio_name")
    }
    
    //JSON columns (TODO)
})

Translates to

supabase.from("movies").select(Columns.raw("name,id::text,actors(name),studio:studios(name),...studios(studio_name:name)"))

@jan-tennert jan-tennert self-assigned this Oct 18, 2024
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

detekt found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@jan-tennert jan-tennert added the enhancement New feature or request label Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request postgrest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant