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

How to extend query with select #60

Open
gu-fan opened this issue Jul 7, 2018 · 0 comments
Open

How to extend query with select #60

gu-fan opened this issue Jul 7, 2018 · 0 comments

Comments

@gu-fan
Copy link

gu-fan commented Jul 7, 2018

I tried

`postss {
      content
      liked_by_me
}`

onQuery(builder){
        // NOT WORK
        builder
        .select(['posts.*',
            Post.relatedQuery('liked_users').count().as('liked_count'),
            Post.relatedQuery('liked_users').select(raw('true')).where('uid', 1).as('liked_by_me')
        ])
}

but got undefined

remove the liked_by_me field works fine

liked_by_me also works fine in normal query

furthermore, I want to extend the liked_by_me with redis, so how to do that?
requery the redis after getting the actual data from db? then how to bind it to graphql?

any advice?

many thanks

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

No branches or pull requests

1 participant