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

graphql: support simple arguments like offset, limit and distinct_on #22

Merged
merged 12 commits into from
Aug 30, 2021

Conversation

kolharsam
Copy link
Owner

@kolharsam kolharsam commented Aug 28, 2021

This PR does some clean-up of the code and resolves #12 and resolves #23 too

To test:
Schema: users(id serial primary key, first_name text, last_name text)

{
    limitUsers: users(limit: 2) {
        first_name
        last_name
    }
    distinctUsers: users(distinct_on: last_name) {
        first_name
        last_name
    }
    offsetUsers: users(offset: 3) {
        first_name
        last_name
    }
}

src/db.rs Outdated Show resolved Hide resolved
src/db.rs Outdated Show resolved Hide resolved
src/server.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@iykekings iykekings left a comment

Choose a reason for hiding this comment

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

Code review completed

@iykekings
Copy link
Collaborator

Functionality-wise:
This might be sth we didn't catch earlier-on:
When I send this payload

{
    limitUsers: users(limit: 1) {
        first_name
        last_name
    }
}

I get this back with the users' alias changed to lowercase

{
    "data": {
        "limitusers": [
            {
                "first_name": "Ikechukwu",
                "last_name": "Eze"
            }
        ]
    }
}

@iykekings
Copy link
Collaborator

Everything works as expected (offset, limit and distinct_on). Great work @kolharsam ❤️‍🔥

src/types.rs Outdated Show resolved Hide resolved
kolharsam and others added 2 commits August 30, 2021 10:06
Co-authored-by: Ikechukwu Eze <iykekings36@gmail.com>
Co-authored-by: Ikechukwu Eze <iykekings36@gmail.com>
Copy link
Collaborator

@iykekings iykekings left a comment

Choose a reason for hiding this comment

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

❤️🔥

@kolharsam kolharsam merged commit ca9d5be into main Aug 30, 2021
@kolharsam kolharsam deleted the sam/graphql/support_simple_args branch August 30, 2021 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants